MySQL NOW() Function

In MySQL, the NOW() function returns the current date and time in YYYY-MM-DD hh:mm:ss or YYYYMMDDhhmmss format.

Unlike SYSDATE(), NOW() returns a constant time that indicates the time at which the statement began to execute. (Within a stored function or trigger, NOW() returns the time at which the function or triggering statement began to execute.)

NOW() is the same as LOCALTIME(), LOCALTIMESTAMP(), and CURRENT_TIMESTAMP().

NOW() Syntax

Here is the syntax of MySQL NOW() function:

NOW()

NOW() Examples

Returns the current time of the system.

SELECT NOW(), NOW() + 1;
+---------------------+----------------+
| NOW()               | NOW() + 1      |
+---------------------+----------------+
| 2022-04-12 02:19:34 | 20220412021935 |
+---------------------+----------------+

Note: The result of NOW() + 0 is in the YYYYMMDDhhmmss format . NOW() + N means adding N seconds to the current datetime.

Unlike SYSDATE(), NOW() returns a constant time that indicates the time at which the statement began to execute. See the example below:

SELECT
    NOW(),
    SYSDATE(),
    SLEEP(2),
    NOW(),
    SYSDATE()\G
    NOW(): 2022-04-12 02:23:14
SYSDATE(): 2022-04-12 02:23:14
 SLEEP(2): 0
    NOW(): 2022-04-12 02:23:14
SYSDATE(): 2022-04-12 02:23:16