Command Reference : String and Date Function Reference
Syntax: @datediff(d1, d2, u)
Argument 1: date number, d1
Argument 2: date number, d2
Argument 3: time unit, u
Return: date number
Returns the difference between two date numbers d1 and d2, measured by time units specified by the time unit string u.
The valid time unit string values are: “A” or “Y” (annual), “S” (semi-annual), “Q” (quarters), “MM” (months), “WW” (weeks), “DD” (days), “B” (business days), “HH” (hours), “MI” (minutes), “SS” (seconds).
Suppose that date1 is 730088.0 (December 1, 1999) and date2 is 729754.0 (January 1, 1999), then,
@datediff(730088.0, 729754.0, "dd")
returns 334 for the number of days between the two dates. Note that this is result is simply the difference between the two numbers.
The following expressions calculate differences in months and weeks:
@datediff(730088.0, 729754.0, "mm")
@datediff(730088.0, 729754.0, "ww")
return 11 and 47 for the number of months and weeks between the dates.