age()

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

Description:

Compute the number of whole years between two time points.

Syntax:

age(dateExp1:formatExp,dateExp2:formatExp)

Note:

The function computes the number of whole years between two time points respectively defined by parameter dateExp1 and parameter dateExp2.

Parameter:

dateExp1/dateExp2

Their values are date expressions; the value of dateExp2 is by default the result of now().

formatExp

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

Option:

@y

Accurate to the year.

@m

Accurate to the month; accurate to the day by default.

Return value:

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