Between Date Function Calls

Last update:

Functions for calculating the differences between two dates.

millisecondsBetween

• First date Type: DateTime
• Second date Type: DateTime

Output

Returns the difference between the two dates, as a Decimal, measured in milliseconds.

For example:

``````millisecondsBetween(dateTime(2007, 1, 1, 1, 1, 1), dateTime(2007,1,1,1,1,3))
``````

results in

``````2000
``````

secondsBetween

• First date Type: DateTime
• Second date Type: DateTime

Output

Returns the difference between the two dates, as a Decimal, measured in seconds.

For example:

``````secondsBetween(dateTime(2007, 1, 1, 1, 1, 1), dateTime(2007,1,1,1,2,3))
``````

results in

``````62
``````

minutesBetween

• First date Type: DateTime
• Second date Type: DateTime

Output

Returns the difference between the two dates, as a Decimal, measured in minutes.

For example:

``````minutesBetween(dateTime(2007, 1, 1, 1, 2, 1), dateTime(2007,1,1,1,1,1))
``````

results in

``````1
``````

hoursBetween

• First date Type: DateTime
• Second date Type: DateTime

Output

Returns the difference between the two dates, as a Decimal, measured in hours.

For example:

``````hoursBetween(dateTime(2007, 1, 1, 3, 31, 1), dateTime(2007,1,1,1,1,1))
``````

results in

``````2.5
``````

daysBetween

• First date Type: DateTime
• Second date Type: DateTime

Output

Returns the difference between the two dates, as a Decimal, measured in days.

For example:

``````daysBetween(dateTime(2007, 2, 13, 1, 1, 1), dateTime(2007,1,1,1,1,1))
``````

results in

``````43
``````

weeksBetween

• First date Type: DateTime
• Second date Type: DateTime

Output

Returns the difference between the two dates, as a Decimal, measured in weeks.

For example:

``````weeksBetween(dateTime(2007, 1, 9, 1, 1, 1), dateTime(2007,1,1,1,1,1))
``````

results in 8 days divided by 7 days in a week:

``````1.1428571428571428
``````

yearsBetween

For this function call, you need the Java Action YearsBetween from the Community Commons module from the App Store.