Within DecisionRules functions, date and time are represented by a date/time ISO string. Functions generating date like NOW or DATE therefore return string which can be then picked up by other date functions. On the other hand, most of the other date functions return numbers, like DATEDIFF, DAY, MONTH or YEAR.
Note that DATE function converts dates to Coordinated Universal Time (UTC) based on specified time zone and Daylight Saving Time (DST) settings. If no time zone is specified, CET (Central European Time) is used by default.
For example, when entering a date like "04.16.2024", it adjusts to "2024-04-15T22:00" (using GMT+2 by default) to align with UTC. If another function uses DATE as a parameter, this adjusted date ("04.15.2024") is then utilized as required.
Tip!
You can append the letter "Z" to the end of the date provided within the DATE function. This indicates that the date should be treated as UTC and will not be converted to UTC.
Examples:
The first argument is the date to be converted (obtained from DATE, NOW or CURDATE).
The second argument is the required date format.
Note:
This function depends on the output of the DATE function. For further details, refer to the info block at the beginning of this page
input ="04/16/2024"[function] ---> [output]// If no letter 'Z' is appeneded then the date is converted to UTC firstDATE_FORMAT(DATE("04/16/2024"), "DD.MM.YYYY") ---> "15.04.2024"// Add 'Z' at the end of the date if you do not want it to be convertedDATE_FORMAT(DATE("04/16/2024Z"), "DD.MM.YYYY") ---> "16.04.2024"DATE_FORMAT(DATE({input}Z), "DD-MM-YYYY") ---> "16-04-2024"DATE_FORMAT(DATE("04/16/2024 Z"), "DDMMMMYY") ---> "16 April 24"DATE_FORMAT(DATE("04/16/2024 Z"), "ddddMMMYY") ---> "TuesdayApr 24"DATE_FORMAT(DATE("04/16/2024 Z"), "ddd") ---> "Tue"DATE_FORMAT(DATE("04/16/2024 15:00 Z"), "ddddDDMMMMhha") ---> "Tuesday 16 April 03 pm"DATE_FORMAT(DATE("04/16/2024 15:30 GMT+5"), "dddd, MMMMD, YYYYh:mmA") ---> "Tuesday, April 16, 2024 10:30 AM"DATE_FORMAT(DATE("04/16/2024T15:30:44","MM/DD/YYYYTHH:mm:ss","s"), "DD.MM.YYYYHH:mm:ss") ---> "16.04.2024 13:30:44"// First parametr must be a DATE, NOW or CURDATE functionDATE_FORMAT("04/16/2024","DD.MM.YYYY") ---> invalid
For a list of all possible date format values, please refer to the Day.js documentation under "List of available formats" (excluding Advanced and Localized format tokens)
Date difference (DATEDIFF)
Returns the number of specified time units between two dates. It may return negative or positive numbers, based on the order of the dates.
Takes 3 arguments.
The first and second argument is a date.
The third argument specifies the time unit, as listed below.
"s"-- seconds"m"-- minutes"H"-- hours"D"-- days"W"-- weeks"M"-- months"Y"-- years