Skip to main content
Version: 8.1

*Between

This function is used by Ignition's Expression language.

Description​

This function is a set of functions that include:

FunctionDescription
millisBetweenCalculates the number of whole milliseconds between two dates.
secondsBetweenCalculates the number of whole seconds between two dates.
minutesBetweenCalculates the number of whole minutes between two dates.
hoursBetweenCalculates the number of whole hours between two dates.
daysBetweenCalculates the number of whole days between two dates. Daylight savings changes are taken into account.
weeksBetweenCalculates the number of whole weeks between two dates.
monthsBetweenCalculates the number of whole months between two dates. Daylight savings changes are taken into account.
yearsBetweenCalculates 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

    • Integer - 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.