Dates and times

NOW

Returns the current date and time — the moment the transaction started.

Syntax

NOW()
CURRENT_TIMESTAMP

NOW() gives the date, time and time zone, and CURRENT_TIMESTAMP is the same thing in standard SQL. The date alone, without the time, comes from CURRENT_DATE. You can add intervals to the result or subtract them: NOW() - INTERVAL '7 days' is a week ago. It's often used as a default value: created_at timestamptz DEFAULT NOW().

Data for the examples

orders

idcreated_atamount
12026-07-03 10:15:00120.50
22026-07-28 18:40:0080.25
32026-08-09 09:05:00199.99
42026-08-21 14:30:0045.00
52026-09-02 11:00:0064.75

These tables already exist in the sandbox — the examples below use them. Want to try this in your own database? Copy the SQL.

Right now
SELECT NOW() AS now,
CURRENT_TIMESTAMP AS standard_name;
nowstandard_name
2026-09-14 12:42:53.677+022026-09-14 12:42:53.677+02

The result below was saved when this page was prepared. Press “Run” to see your current time.

A week ago and an hour from now
SELECT NOW() - INTERVAL '7 days' AS week_ago,
NOW() + INTERVAL '1 hour' AS in_an_hour;
week_agoin_an_hour
2026-09-07 12:42:53.679+022026-09-14 13:42:53.679+02
How much time has passed since each order
SELECT id, created_at,
NOW() - created_at AS time_passed
FROM orders;
idcreated_attime_passed
12026-07-03 10:15:0073 days 02:27:53.681
22026-07-28 18:40:0047 days 18:02:53.681
32026-08-09 09:05:0036 days 03:37:53.681
42026-08-21 14:30:0023 days 22:12:53.681
52026-09-02 11:00:0012 days 01:42:53.681

Watch out

NOW() doesn't change during a transaction: the value is the same in every row and every query between BEGIN and COMMIT. The true current moment, fresh every time, comes from clock_timestamp().

How the result looks depends on the session's time zone: the same moment is shown differently on different computers. To store moments, use the timestamptz type.

Related functions