Months ago | DATE_MONTHS_AGO
Syntax
DATE_MONTHS_AGO( [value], [now = CURRENT_DATE()] )
Parameters
value
A DATE value.
If the value is not a DATE, it will be converted to one with the DATE operation.
now
A DATE value that specifies the logical current time.
If not provided, the current date is used.
If the value is not a DATE, it will be converted to one with the DATE operation.
Return Value
The number of full months the VALUE is before NOW.Description
Determine how many full months ago a DATE is from the current date.Examples
DATE_MONTHS_AGO("2017-08-30T17:36:23.000Z", "2017-08-30T17:36:23.000Z") # returns 0
DATE_MONTHS_AGO("2015-08-30T17:36:23.000Z", "2017-08-30T17:36:23.000Z") # returns 12
DATE_MONTHS_AGO("2016-08-30T17:36:23.000Z", "2017-07-30T17:36:23.000Z") # returns 11