Function Reference

NOW

Returns the current date and time.

MySQL 8.1
NOW([fsp])

Parameters

fspINToptional
Number of fractional seconds digits from 0 to 6, 0 by default

Return value

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

Examples

Current date and time

MySQL 8.1
SELECT NOW();

With milliseconds

MySQL 8.1
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