In this guide, we will explain how to use the MySQL LOCALTIME function with syntax and examples.
Description
The MySQL LOCALTIME function returns the current date and time.
Syntax
The syntax for the LOCALTIME function is:
LOCALTIME( )
Parameters or Arguments
There are no parameters or arguments for the LOCALTIME function.
Note
- The LOCALTIME function will return the current date as a ‘YYYY-MM-DD HH:MM:SS’ format, if used in a string context.
- The LOCALTIME function will return the current date as a YYYYMMDDHHMMSS format, if used in a numeric context in versions of MySQL prior to MySQL 4.1.13.
- The LOCALTIME function will return the current date as a YYYYMMDDHHMMSS.uuuuuu format, if used in a numeric context in versions of MySQL 4.1.13 and newer.
- The LOCALTIME, CURRENT_TIMESTAMP, and LOCALTIMESTAMP functions are synonyms for the NOW function.
Applies To
The LOCALTIME function can be used in the following versions :
- MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1, MySQL 4.0, MySQL 3.23
Example
Let’s look at some LOCALTIME function examples and explore how to use the LOCALTIME function.
For example:
mysql> SELECT LOCALTIME(); Result: '2014-02-16 08:56:05' mysql> SELECT LOCALTIME() + 0; Result: 20140216085605.000000 mysql> SELECT LOCALTIME() + 1; Result: 20140216085606.000000
Next Topic : Click Here
Pingback: MySQL: LAST_DAY Function | Adglob Infosystem Pvt Ltd