PostgreSQL 18 reference · Date and Time Functions
PostgreSQL NOW() Function
Return the current date and time with time zone, fixed at the start of the transaction. current_timestamp is the same.
PostgreSQL 18
Syntax
now() | current_timestamp | clock_timestamp()
Return value
timestamp with time zone.
Examples
SELECT now() = current_timestamp AS same_value, now() > '2026-01-01' AS after_2026;
Output
same_value | after_2026 ------------+------------ t | t (1 row)
Run this on your computer — see “Get Started” for setup.
SELECT now() = now() AS fixed_in_transaction, clock_timestamp() >= now() AS clock_moves_on;
Output
fixed_in_transaction | clock_moves_on ----------------------+---------------- t | t (1 row)
Run this on your computer — see “Get Started” for setup.
now() returns the same value for the whole transaction, so rows inserted together share a timestamp. Use
clock_timestamp() when you need the time at the moment of the call.
In other languages
DATETIME()· SQLite
Related
CURRENT_DATE· Return today's date (in the session's time zone) as a date with no time part. It's written without parentheses.DATE_TRUNC()· Truncate a timestamp or interval to a unit such as 'month', 'week' or 'hour', for grouping by period.AGE()· Subtract dates and return a 'symbolic' interval in years, months and days. With one argument it counts from today.- SQL Date Functions · tutorial