date-time

NOW / CURRENT_TIMESTAMP

Returns the current transaction (or statement) timestamp. Both spellings work in Postgres and MySQL; SQLite prefers CURRENT_TIMESTAMP or datetime('now').

NOW()  |  CURRENT_TIMESTAMP

Parameters / Modifiers

Parameter Purpose
CURRENT_DATE Date-only value for today
CURRENT_TIME Time-only current value
clock_timestamp() Postgres: actual wall-clock time (changes within a transaction)
STATEMENT_TIMESTAMP() Postgres: start of current statement

Examples

SELECT NOW();

Returns e.g. 2026-07-16 12:34:56+00 in Postgres

INSERT INTO logs (msg, created_at) VALUES ('boot', CURRENT_TIMESTAMP);

Portable insert-timestamp pattern

SELECT datetime('now');

SQLite equivalent (UTC by default)

SELECT clock_timestamp() - transaction_timestamp();

Postgres: elapsed time inside the current transaction

Dialect notes / Gotcha

In Postgres NOW() is frozen for the entire transaction — use clock_timestamp() for real wall time. SQLite datetime('now') is UTC unless you append 'localtime'.

Related functions

← All SQL functions · SQL cheat sheet · Window functions · PostgreSQL cheat sheet