seconds_between() function

The seconds_between() function determines the truncated number of full seconds between two time stamps.

The seconds_between() function ignores leap seconds. A leap second is an extra second that is added at the direction of the International Earth Rotation and Reference System Service (IERS) as needed to adjust atomic time with Earth's rotation. The IERS added a leap second at 23:59:60 UTC on 30 June 2012.

Syntax

The seconds_between() function has the following syntax:
int8 = seconds_between(timestamp t1, timestamp t2);

The t1 value specifies the beginning time stamp.

The t2 value specifies the ending time stamp.

Returns

The function returns the truncated number of full seconds between the t1 and t2 values.

Example

select seconds_between('1996-02-27 06:12:33','1996-02-27 06:55:22');
 SECONDS_BETWEEN
-----------------
            2569
(1 row)