$(date)
Description
This built-in function provides basic operation to manipulate date such add “adding day”, “setting hour”. This
built-in function assumes the date parameter in the standard US date format (i.e. MM/dd/yyyy HH:mm:ss). You might
want to consider using $(date|stdFormat|date|fromFormat) or $(date|format|date|fromFormat|toFormat) functions to
derive the appropriate format first before invoking other date-operational functions.
Date Format
For date/time formatting (denoted below as format or *Format), Nexial supports the following 3 conventions:
- Standard Java date/time formatting convention for a full range to express the desired date/time format.
- epoch
for timestamp. Use
epochto signify the display of date/time value in its epoch value (millisecond). informalto express date/time information in a colloquial, non-exact manner that mimic human conversation. For example,informalformat would outputabout a minute agoinstead of00:00:57, orabout a month and a half agorather than2018/08/24 00:01:32. Theinformalformat is suitable to use in conjunction with the sound »speak(text)command.base10timeto express time information as a base-10 decimal number. For example,10:25:30would be converted as10.425,14.32918would be converted as14:19:46.
Available Functions
$(date|stdFormat|date|fromFormat)
Convert a date from fromFormat to the standard format (i.e. MM/dd/yyyy HH:mm:ss).
Example
Script:
_01.png)
Output:
_02.png)
$(date|format|date|fromFormat|toFormat)
Convert a date from the specified fromFormat to the specified toFormat. Check out above links
for date format.
Example
Script:
_03.png)
Output:
_04.png)
$(date|addYear|date|years)
Add years to date. Use negative value to denote the “subtract” intent. The specified date is assumed in standard
format (MM/dd/yyyy HH:mm:ss).
Example
Script:
_05.png)
Output:
_06.png)
$(date|addMonth|date|months)
Add months to date. Use negative value to denote the “subtract” intent. The
specified date is assumed in standard format (MM/dd/yyyy HH:mm:ss).
Example
Script:
_07.png)
Output:
_08.png)
$(date|addDay|date|days)
Add days to date. Use negative value to denote the “subtract” intent. The specified
date is assumed in standard format (MM/dd/yyyy HH:mm:ss).
Example
Script:
_09.png)
Output:
_10.png)
$(date|addHour|date|hours)
Add hours to date. Use negative value to denote the “subtract” intent. The
specified date is assumed in standard format (MM/dd/yyyy HH:mm:ss).
Example
Script:
_11.png)
Output:
_12.png)
$(date|addMinute|date|minutes)
Add minutes to date. Use negative value to denote the “subtract” intent. The
specified date is assumed in standard format (MM/dd/yyyy HH:mm:ss).
Example
Script:
_13.png)
Output:
_14.png)
$(date|addSecond|date|seconds)
Add seconds to date. Use negative value to denote the “subtract” intent. The
specified date is assumed in standard format (MM/dd/yyyy HH:mm:ss).
Example
Script:
_15.png)
Output:
_16.png)
$(date|diff|date1|date2|precision)
Find the absolute difference between 2 dates (date1 and date2) and return such value in the specified date
precision. The possible values of precision are YEAR, MONTH, WEEK, DAY, HOUR, MINUTE, SECOND and
MILLISECOND. The specified dates (date1 and date2) are assumed in standard format (MM/dd/yyyy HH:mm:ss).
Example
Script:
_17.png)
Output:
_18.png)
$(date|setYear|date|years)
Set the year portion of date to the specified years. The specified date is
assumed in standard format (MM/dd/yyyy HH:mm:ss).
Example
Script:
_19.png)
Output:
_20.png)
$(date|setMonth|date|months)
Set the month portion of date to the specified months. The specified date is
assumed in standard format (MM/dd/yyyy HH:mm:ss).
Example
Script:
_21.png)
Output:
_22.png)
$(date|setDay|date|days)
Set the day portion of date to the specified days. The specified date is assumed
in standard format (MM/dd/yyyy HH:mm:ss).
Example
Script:
_23.png)
Output:
_24.png)
$(date|setHour|date|hours)
Set the hour portion of date to the specified hours. The specified date is
assumed in standard format (MM/dd/yyyy HH:mm:ss).
Example
Script:
_25.png)
Output:
_26.png)
$(date|setMinute|date|minutes)
Set the minute portion of date to the specified minutes. The specified
date is assumed in standard format (MM/dd/yyyy HH:mm:ss).
Example
Script:
_27.png)
Output:
_28.png)
$(date|setSecond|date|seconds)
Set the second portion of date to the specified seconds. The specified
date is assumed in standard format (MM/dd/yyyy HH:mm:ss).
Example
Script:
_29.png)
Output:
_30.png)
$(date|setDOW|date|day)
Derive the “day of the week” for a given date. The specified date is assumed in standard format (MM/dd/yyyy HH:mm:ss
or MM/dd/yyyy). Use the days parameter to set the day of the week. As a convenience, both 0 and 7 represent
Sunday, while 6 represents Saturday. Since there are only 7 days in a week, any integer value outside the range of 0
through 7 would be considered as value. For example, March 21th 2013 is a Thursday. $(date|setDOW|03/21/2013|1) would
yield 03/18/2013, which is a Monday.
Example
Script:
_31.png)
Output:
_32.png)