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:
Parameter | Description |
---|---|
timestamp endTime | end of the interval as a timestamp |
timestamp startTime | start 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"))