age() function

Returns the difference between two dates.

The difference is returned as a Interval and needs to be used with one of the following functions in order to extract useful information:

Syntax

age(string,string)
age(datetime,datetime)
age(string,datetime)
age(datetime,string)

Arguments

string - is string. A string in date format.
datetime - is date or datetime. A date or datetime type.

Example

age('2012-05-12','2012-05-2') → Interval
use day to extract number of days
day(age('2012-05-12','2012-05-2')) → 10