Built-in Functions → timeBetween

timeBetween() is a scalar date function that returns the interval between two given timestamps (Start time and End time )in milliseconds.

Signature

timeBetween(timestamp endTime, timestamp startTime)

The following table illustrates the timeBetween() parameters:

ParameterDescription
timestamp endTimeend of the interval as a timestamp
timestamp startTimestart of the interval as a timestamp

Returns

long

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"))