timeBetween

Returns the interval between two given times in milliseconds.

Example

In the example, the function returns 300,000 milliseconds, which is 5 minutes.

timeBetween(timestamp("2001-12-24 23:05:00.000"),
              timestamp("2001-12-24 23:00:00.000"))

Syntax

timeBetween(timestamp endTime, timestamp startTime)
  • endTime: end of the interval as a timestamp
  • startTime: start of the interval as a timestamp

    Returns

    long

Notes

timeBetween takes the end time (endTime) and start time (startTime), and returns the duration between the two given timestamps in milliseconds.