add*
This function is used by Ignition's Expression language.
Description​
This function is a set of functions that include:
Function | Description |
---|---|
addMillis | Add or subtract an amount of milliseconds to a given date and time. |
addSeconds | Add or subtract an amount of seconds to a given date and time. |
addMinutes | Add or subtract an amount of minutes to a given date and time. |
addHours | Add or subtract an amount of hours to a given date and time. |
addDays | Add or subtract an amount of days to a given date and time. |
addWeeks | Add or subtract an amount of weeks to a given date and time. |
addMonths | Add or subtract an amount of months to a given date and time. This function is unique since each month can have a variable number of days. For example, if the date passed in is March 31st, and we add one month, April does not have a 31st day, so the returned date will be the proper number of months rounded down to the closest available day, in this case April 30th. |
addYears | Add or subtract an amount of years to a given date and time. |
Syntax​
add*(date, value)
Parameters
Date date - The starting date.
Integer value - The amount of units to change the date by, where the units is dependent on the function used.
Results
- Date - A new date that has been changed by the amount specified.
Code Examples​
Code Snippet
addWeeks(now(), 2) //Adds 2 weeks to the current time
Code Snippet
addDays(now(), -5) //Subtracts 5 days from the current time.
Code Snippet
addHours({Root Container.Calendar.date}, 5) //This example would add 5 hours to the date passed in from a calendar component