Function or operator · Text, numbers and dates

CURRENT_TIMESTAMP

CURRENT_TIMESTAMP returns the current date and time according to the engine. Use it to record or compare points in time.

CURRENT_TIMESTAMP example

Current date and time
SELECT CURRENT_TIMESTAMP AS now;

Use it to record when an operation happened. The type, the time zone and the reference moment depend on the engine.

How CURRENT_TIMESTAMP is used

The value changes every time the query runs. That is why an example in a guide should not show one specific time as if it were universal.

What changes from case to case

Using it as a default value

A common use is recording when a row was inserted. The exact syntax and the recommended type depend on the engine, but this form works in SQLite for a text date column and is a familiar pattern on other engines too:

Example
CREATE TABLE events (
  id INTEGER PRIMARY KEY,
  name TEXT NOT NULL,
  created_at TEXT DEFAULT CURRENT_TIMESTAMP
);

Type matters. In a real database, choose the date/time type that suits your engine rather than copying TEXT as a general rule. The example above is meant to show how SQLite behaves.

Time zone and reference moment

The differences between engines matter. SQLite documents CURRENT_TIMESTAMP as UTC text in the format YYYY-MM-DD HH:MM:SS for default values. SQL Server returns a datetime based on the instance's system clock, with no time zone offset. PostgreSQL provides current date/time values with their own transaction and session semantics.

If you need UTC, local time or an explicit offset, document that decision and use the matching function or type for your engine. Do not infer the time zone from the text displayed.