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:

 - year
 - month
 - week
 - day
 - hour
 - minute
 - second

Syntax

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

Arguments

string - is string. A sting 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 numbder of days
day(age('2012-05-12','2012-05-2')) -> 10