Skip to content

LOCALTIMESTAMP

  • precision: This parameter defines the number of fractional digits retained in the seconds field. A value of 0 signifies second precision, while a maximum value of 6 signifies microsecond precision. The absence of a precision value defaults the digit precision to 6 in PostgreSQL. The precision value is optional for LOCALTIMESTAMP.
SELECT LOCALTIMESTAMP;
localtimestamp
--------------------------------
2022-04-20 12:43:16.987654+00
(1 row)

The LOCALTIMESTAMP function in PostgreSQL is used to return the current date and time with the fractional part in seconds precision. The output will vary depending on the time of execution. In the given example, LOCALTIMESTAMP is used to return the current timestamp.