MySQL LOCALTIME() Function

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

This function is exactly the same as the NOW() function.

LOCALTIME() Syntax

Here is the syntax of MySQL LOCALTIME() function:

LOCALTIME
LOCALTIME()

LOCALTIME() Examples

Returns the current time of the system.

SELECT LOCALTIME(), LOCALTIME() + 1;
+---------------------+-------------------------+
| LOCALTIME()         | LOCALTIME() + 1         |
+---------------------+-------------------------+
| 2022-04-12 02:29:32 |          20220412022933 |
+---------------------+-------------------------+

Here, the context of LOCALTIME() is a mathematical operation within LOCALTIME() + 1, so LOCALTIME() returns a number in YYYYMMDDhhmmss format.