Function Reference

NOW

Returns the current date and time.

MySQL 8.4
NOW([fsp])
  • [ ]optional part
fsp
Number of fractional seconds digits, 0 by default
INTOptional
0123456

Return value

A datetime (DATETIME) as of the start of the query

Examples

Current date and time

MySQL 8.4
SELECT NOW();

With milliseconds

MySQL 8.4
SELECT NOW(3);

Details

Synonyms are CURRENT_TIMESTAMP, LOCALTIME and LOCALTIMESTAMP. The value is taken in the session time zone and fixed at the start of the query: all NOW() calls in one query return the same value. The moment of the call itself is given by SYSDATE().

An fsp greater than 6 is an error. To shift the moment, add an interval: NOW() - INTERVAL 1 HOUR.

See also

Where to learn