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
DATE_TRUNC
Rounds a timestamp down to the beginning of the specified unit (year, month, week, day, hour, etc.). Native to Postgres; MySQL uses DATE_FORMAT or manual arithmetic.
EXTRACT / DATE_PART
Pulls a numeric component (year, month, day, hour, minute, dow, epoch) out of a date or timestamp. EXTRACT is SQL-standard and works in Postgres and MySQL; DATE_PART is a Postgres synonym.
INTERVAL arithmetic
Adds or subtracts a duration to a date/timestamp. Postgres uses the SQL-standard INTERVAL literal directly; MySQL wraps it in DATE_ADD/DATE_SUB; SQLite uses date modifiers.
← All SQL functions · SQL cheat sheet · Window functions · PostgreSQL cheat sheet