age()

Read(2362) Label: time, interval, year, month, day,

Description:

Compute the number of whole years between two specified time points.

Syntax:

age(dateExp1:formatExp,dateExp2:formatExp)

Note:

The function computes the number of whole years between the time point defined by parameter dateExp1 to another time point defined by dateExp2. dateExp2 is by default the result of now().

Parameter:

dateExp1/dateExp2

Date expression whose result is the date

formatExp

Format expression, such as "yyyyMMdd","yyyy-MM-dd"

Option:

@y

The result is accurate to the year

@m

The result is accurate to the month

The computation is accurate to the day by default

Return value:

An integer

Example:

 

A

 

1

=age(date("1980-09-01"))

The number of whole years between 1980-09-01 and the current time.

2

=age(date("1980-09-01"),date("1985-01-01"))

4

3

=age@y(date("1980-09-01"),date("1985-01-01"))

5

4

=age@m("19800227":"yyyyMMdd",date("1999-02-02"))

19