Skip to content

LOCALTIMESTAMP

Return the date and time when the current transaction starts. This value does not change during the course of a transaction and does not reflect the individual start times of statements within a transaction.

LOCALTIMESTAMP[(6)]

The number 6 (for the fractional seconds part of the timestamp) is optional and does not affect the result. This function always returns a precision of 6. The return type is TIMESTAMP.

premdb=# SELECT LOCALTIMESTAMP;
        timestamp          
----------------------------
 2016-05-23 16:01:23.347666
(1 row)

premdb=# SELECT LOCALTIMESTAMP, matchday FROM match LIMIT 2;
     timestamp      |      matchday       
---------------------+---------------------
 2016-05-23 16:02:03 | 2006-10-28 00:00:00
 2016-05-23 16:02:03 | 2006-09-16 00:00:00
(2 rows)

Parent topic:Datetime Functions