DateDiff
Returns an integer value in the same units as the datePart parameter. The return value is the result of subtracting the first date and time from the second date and time.
Syntax
DateDiff(datePart, firstDateTime, secondDateTime)
Enabled for
Search/Dashboard | No |
Business Rules | Yes |
Quick Actions | Yes |
Workflow Objects | Yes |
Reports | No |
Parameters
datePart |
The interval type. Must be surrounded by quotes (" "). The following interval types are supported:
|
firstDateTime |
The first date and time to be compared. |
secondDateTime |
The second date and time to be compared. |
Return Value
Number value.
If the firstDateTime parameter is later than the secondDateTime parameter, the returned value is positive. If the firstDateTime parameter is earlier than the secondDateTime parameter, the returned value is negative.
Example
To calculate the weekday of a given date within a quick action, you can use:
$(DateDiff("day", ToString(CurrentDate()), "2011-12-31 11:59 PM") % 7)
This results in 1 for Sunday, 2 for Monday, and so on.