DATE_DELTA
Last updated
Was this helpful?
Last updated
Was this helpful?
The function DATE_DELTA returns returns the number of total years, total months, and total days between two DATES.
This function takes two as input. It returns he number of total years, total months, and total days between the two Dates. This output is technically formatted as another , but, unlike most , it does not express a valid date. Calculation takes into account irregularities such as daylight savings time and leap years.
date1 (required, type: Date) Any date.
date2 (required, type: Date) Any date.
delta (type: Date) The number of total years, total months, and total days between two date1 and date2. Calculation takes into account irregularities such as daylight savings time and leap years. Unlike most , delta does not express a valid date.
Assume the following examples have access to the following Date values:
DATE_DELTA returns the absolute difference between the given Dates; it does not matter which is given first. The following example returns the the number of days, months, and years between example_date2 and example_date1; note that the output is the same as the above example, even though the Date values are given in reverse order:
Assume the following examples have access to example_date1 and example_date2 from the Examples section. The isolated difference between days, months, and years (respectively) between them can be found as follows:
The following example returns the the number of total days, total months, and total years between example_date1 and example_date2. Note that the values associated with "day" and "month" are too large to be valid values describing a real ; rather, the describe the total number of days and months (respectively) between the two given Dates:
The Date returned by DATE_DELTA does not contain conventional Date information; while it is technically possible to use it as Date input in functions such as or , the output returned in such cases will not be meaningful. To avoid such confusion, it is best practice to use DATE_DELTA in tandem with the , , or function, like so:
This returns a single : the days, months, or years, respectively, between the two dates.