The LOCALTIME() function returns the current date and time as a string YYYY-MM-DD hh:mm:ss or numerically as BIGINTYYYYMMDDhhmmss or as DECIMALYYYYMMDDhhmmss.microseconds, depending on whether the function is used in string or numeric context.
The value is expressed in the format of the current session time zone.
The "Precision" argument can be specified to indicate a sub-second precision from 0 to 6 digits.
The specification of "Precision" must be a written number from 0-6. Expressions or variables produce a syntax error, larger values produce a precision error.
Unlike the NOW() function, this function can omit the parentheses if "Precision" is not specified.
Setting the system variable timestamp takes affect to the function LOCALTIME() in contrast to then SYSDATE() function.
The examples were created with the MyWAY SQL manager: Download
How to use the LOCALTIME() function in MySQL and MariaDB databases
In MySQL and MariaDB the LOCALTIME() function is used to get the current date and time. The function returns the current timestamp in the format "YYYY-MM-DD HH:MM:SS". LOCALTIME() can be used to get current date and time in SQL queries, as default value for timestamp columns in tables, in timezone consideration or in various calculations or manipulations with timestamps using functions that add or subtract time intervals from the current timestamp value.
Further MySQL und MariaDB SQL Date and Time functions