Skip to content
Tutorials Center
My learning

Topics

SQL Reference ยท Date and Time Functions

SQL CURRENT_DATE, CURRENT_TIME and CURRENT_TIMESTAMP

Reference for CURRENT_DATE, CURRENT_TIME and CURRENT_TIMESTAMP: get the current date and time in SQL, UTC versus local time, and NOW(), GETDATE() and SYSDATE in other databases.

CURRENT_DATE, CURRENT_TIME and CURRENT_TIMESTAMP are standard SQL keywords that return the date, the time and the date plus time at the moment the statement runs. They are written without parentheses, like constants. They are used for default values (created_at DEFAULT CURRENT_TIMESTAMP), for "as of now" filters and for stamping rows.

All three values stay the same throughout one statement, so every row of a bulk INSERT gets the identical timestamp. In SQLite they always return UTC as text: '2025-02-14', '20:57:33' and '2025-02-14 20:57:33'.

SQL
SELECT CURRENT_DATE, CURRENT_TIME, CURRENT_TIMESTAMP;

Try it

SQL What the three keywords look like

Press Run (or Ctrl + Enter) to see the result here.

SQL Using the current time as a default and a filter

Press Run (or Ctrl + Enter) to see the result here.

The exact values depend on when you press Run, so these examples print lengths and comparisons instead of the clock.

Syntax

SQL
CURRENT_DATE
CURRENT_TIME
CURRENT_TIMESTAMP
Keyword Standard result SQLite result
CURRENT_DATE a DATE text YYYY-MM-DD (UTC)
CURRENT_TIME a TIME WITH TIME ZONE text HH:MM:SS (UTC)
CURRENT_TIMESTAMP a TIMESTAMP WITH TIME ZONE text YYYY-MM-DD HH:MM:SS (UTC)

Returns: the value for the current moment. The three keywords never return NULL.

Dialect differences

Database Notes
SQLite UTC text. Use DATETIME('now', 'localtime') for local time and STRFTIME('%f', 'now') for fractions of a second.
PostgreSQL All three standard keywords work; CURRENT_TIMESTAMP is a timestamptz in the session time zone. NOW() is the same. LOCALTIMESTAMP has no zone.
MySQL CURRENT_TIMESTAMP (alias NOW()), CURRENT_DATE (alias CURDATE()), CURRENT_TIME (alias CURTIME()). They use the session time zone. Parentheses are optional.
SQL Server CURRENT_TIMESTAMP and GETDATE() give a datetime; SYSDATETIME() has more precision; SYSUTCDATETIME() is UTC. There is no CURRENT_DATE; use CAST(GETDATE() AS date).
Oracle CURRENT_DATE, CURRENT_TIMESTAMP, SYSDATE (database server time), SYSTIMESTAMP.
SQL
-- PostgreSQL / MySQL
SELECT NOW();

-- SQL Server
SELECT GETDATE(), SYSUTCDATETIME();

-- Oracle
SELECT SYSDATE FROM dual;

Usage notes

  • UTC versus local. Store UTC and convert to a user's time zone when displaying. In SQLite, adding 'localtime' as a modifier converts using the machine's zone.
  • Stable inside a statement. The value is read once, so CURRENT_TIMESTAMP = CURRENT_TIMESTAMP is always true, and a multi-row insert shares one timestamp.
  • Defaults. DEFAULT CURRENT_TIMESTAMP fills the column when an insert omits it. Updates do not touch it unless you set it yourself or add a trigger.
  • "Today" filters. WHERE ordered_at >= CURRENT_DATE works on ISO text because it sorts chronologically. See date modifiers for yesterday, last month and so on.
  • Testing. Queries that use the clock return different results every run; pass the date as a parameter in tests.
  • Seconds only. SQLite's CURRENT_TIMESTAMP has no fractional seconds.