PostgreSQL 17.5
LOCALTIMESTAMP[(precision)]Parameters
- precisionintegeroptional
- Number of fractional digits of the seconds, 0 to 6; all 6 by default
Return value
A timestamp without time zone (timestamp) at the start of the transaction
Examples
Current time without and with a time zone
PostgreSQL 17.5
SELECT LOCALTIMESTAMP AS local_now,
NOW() AS with_zone;Without fractional seconds and an hour ago
PostgreSQL 17.5
SELECT LOCALTIMESTAMP(0) AS without_fractions,
LOCALTIMESTAMP - INTERVAL '1 hour' AS hour_ago;Details
The time is taken in the time zone from the TimeZone setting (UTC in the sandbox), but the zone itself is not stored in the value. Like NOW(), the value does not change within a transaction. Without precision it is written without parentheses.