dateArithmetic
This function is used by Ignition's Expression language.
Description​
Adds or subtracts some amount of time from a date, returning the resulting date. The field argument must be a string, and must be one of these options:
- ms
- second
- sec
- minute
- hour
- hr
- day
- week
- month
- year
Syntax​
dateArithmetic(date, value, field)
Parameters​
Type | Parameter | Description |
---|---|---|
Date | date | The starting date. |
Integer | value | The amount to add or subtract from the given date. |
String | field | The units of the value. |
Returns​
Date - A new date that has been altered by the specified amount of time units.
Examples​
Code Snippet
dateArithmetic(toDate("2010-01-04 8:00:00"), 5, "hour") //returns the date '2010-01-04 13:00:00'
Code Snippet
dateArithmetic({Root Container.DatePicker.date}, -8, "days") //returns a date eight days before the date in a Popup Calendar component.