// dates & times reference

SQL NOW / CURRENT_TIMESTAMP function

Returns the current date and time. CURRENT_TIMESTAMP is the standard spelling and works on all five engines; NOW(), GETDATE() and SYSDATE are dialect names that differ in precision and in when they are evaluated.

Catégorie
Dates & times
Returns
timestamp (text on SQLite)
In this category
1 of 121

Syntaxe

CURRENT_TIMESTAMP
NOW()
GETDATE() / SYSDATETIME()
SYSTIMESTAMP
datetime('now')

Each block is a separate form. The support table and the examples show which engine takes which.

Prise en charge des moteurs

MoteurSupportNotes
SQL Server Oui CURRENT_TIMESTAMP or GETDATE() (datetime); SYSDATETIME() for datetime2; no NOW()
PostgreSQL Oui Supported under this name.
MySQL Oui NOW() and CURRENT_TIMESTAMP give the statement start; SYSDATE() the moment of the call
SQLite Oui CURRENT_TIMESTAMP or datetime('now'); returns UTC text, no NOW()
Oracle Oui CURRENT_TIMESTAMP (session zone), SYSTIMESTAMP and SYSDATE (server clock); no NOW()

Exemples

Any engine

SELECT CURRENT_TIMESTAMP AS loaded_at;

SQL Server

SELECT SYSDATETIME() AS loaded_at;

SQLite

SELECT datetime('now', 'localtime') AS loaded_at;

Bon à savoir

  • PostgreSQL's now() and CURRENT_TIMESTAMP are the transaction start time, frozen for the whole transaction; clock_timestamp() keeps moving.
  • SQLite's CURRENT_TIMESTAMP and datetime('now') return UTC text like '2026-08-01 14:30:00', not local time. datetime('now', 'localtime') converts.
  • Precision differs: SQL Server's GETDATE() and CURRENT_TIMESTAMP are datetime, accurate to about 3 ms; SYSDATETIME() is datetime2 with 100 ns. MySQL's NOW() has whole seconds unless you ask for NOW(6).
  • Oracle's SYSDATE and SYSTIMESTAMP read the database server's clock and time zone; CURRENT_TIMESTAMP uses the session time zone, so two clients in different zones see different values.

Questions about NOW / CURRENT_TIMESTAMP

Is NOW() the time the statement ran?

On PostgreSQL it is the time the transaction started, so every statement in the transaction sees the same value. MySQL's NOW() is the time the statement started; its SYSDATE() changes even within one statement. SQL Server evaluates GETDATE() once per reference in a query, not per row.

Why is SQLite's datetime('now') in the wrong time zone?

It is UTC by design. Add 'localtime' as a modifier to get the machine's local time, or keep storing UTC and convert for display, which survives daylight-saving changes and servers moving zones.

Browse every function in the SQL function reference, or see what the SQLly desktop app does for your database.

// fewer lookups

Functions your engine actually has

SQLly's completion lists the built-in functions of the engine you're connected to, whether that's SQL Server, PostgreSQL, MySQL, SQLite or Oracle. Hover a function for help, and signature hints show each argument as you type.