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
Date date - The starting date.
Integer value - The value to add or subtract from the given date.
String field - The units of the value.
Results
- Date - A new date, that has been altered by the amount of units specified.
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.