Use date functions in rules to manipulate date values in asset JSON at runtime.
For instance, a date function can update date values to a standardized format. If a user enters a date value in the wizard, the date function can update the format at runtime.
format
Parameters: Date dateValue, String format
Returns: String
Recursive: Not supported
Description: Returns a formatted string of the provided date/time value based on the provided format.
Example
This function call:
{
"format": "${date:format('01/02/2022', 'yyyy/MM/dd')}"
}
Returns:
{
"format": "2022/01/02"
}
parse
Parameters: String dateValue, String format
Returns: Date
Recursive: Not supported
Description: Parses the given date/time value based on the provided format.
Example
This function call:
{
"parsedDate": "${date:parse('01/02/2022', 'yyyy/MM/dd')}"
}
Returns:
{
"parsedDate": "2022/01/02"
}
add
Parameters: Date dateValue, String field, int delta
Returns: Date
Recursive: Not supported
Description: Performs date/time arithmetic on the provided dateValue on the provided valid date field (year, month, day, hour, minute, second, millisecond) using the delta value to increase or decrease the date field by.
Example
This function call:
{
"addedDate": "${date:add('2022/01/03 14:22:00', 'year', 3)}"
}
Returns:
{
"addedDate": "2025/01/03 14:22:00"
}
now
Parameters: None
Returns: Date
Recursive: Not supported
Description: Returns the current date and time.
Example
This function call:
{
"rightNow": "${date:now()}"
}
Returns:
{
"rightNow": 1790715391598
}