date Functions

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:

1{
2    "format": "${date:format('01/02/2022', 'yyyy/MM/dd')}"
3}

Returns:

1{
2    "format": "2022/01/02"
3}

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:

1{
2    "parsedDate": "${date:parse('01/02/2022', 'yyyy/MM/dd')}"
3}

Returns:

1{
2    "parsedDate": "2022/01/02"
3}

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:

1{
2    "addedDate": "${date:add('2022/01/03 14:22:00', 'year', 3)}"
3}

Returns:

1{
2    "addedDate": "2025/01/03 14:22:00"
3}

now 

Parameters: None

Returns: Date

Recursive: Not supported

Description: Returns the current date and time.

Example 

This function call:

1{
2    "rightNow": "${date:now()}"
3}

Returns:

1{
2    "rightNow": 1790715391598
3}