*Between
This function is used by Ignition's Expression language.
Description
This function is a set of functions that include:
Function | Description |
---|---|
millisBetween | Calculates the number of whole milliseconds between two dates. |
secondsBetween | Calculates the number of whole seconds between two dates. |
minutesBetween | Calculates the number of whole minutes between two dates. |
hoursBetween | Calculates the number of whole hours between two dates. |
daysBetween | Calculates the number of whole days between two dates. Daylight savings changes are taken into account. |
weeksBetween | Calculates the number of whole weeks between two dates. |
monthsBetween | Calculates the number of whole months between two dates. Daylight savings changes are taken into account. |
yearsBetween | Calculates the number of whole years between two dates. Daylight savings changes are taken into account. |
Order does matter for the two dates passed in that we are calculating how much time has passed from date 1 to date 2. So, if date 2 is further in time than date 1, then a positive amount of time has passed. If date 2 is backwards in time from date 1, then a negative amount of time has passed.
Syntax
*between(date1, date2)
Parameters
Date date1 - The first date to compare.
Date date2 - The second date to compare.
Results
- int - The number of units between the two dates. The units is specified by the function used.
Code Examples
Code Snippet
daysBetween(toDate("2017-04-28 00:00:00"), toDate("2017-03-22 00:00:00")) //This will print -37
Code Snippet
weeksBetween({Root Container.Calendar1.date}, {Root Container.Calendar2.date}) //Will grab the number of weeks between two dates of calendar components.