LOCALTIMESTAMP() Function in MySQL
Last Updated :
27 Nov, 2020
LOCALTIMESTAMP() function :
This function in MySQL is used to return the current date and time in the format of “YYYY-MM-DD HH-MM-SS” (string) or as YYYYMMDDHHMMSS.uuuuuu (numeric).
Syntax :
LOCALTIMESTAMP
OR
LOCALTIMESTAMP()
Parameter :
This method does not accept any parameters.
Returns :
It returns the current date and time.
Example-1 :
Getting current date and time “2020-11-25 07:57:09” in the format of “YYYY-MM-DD HH-MM-SS”.
SELECT LOCALTIMESTAMP();
Output :
2020-11-25 07:57:09
Example-2 :
Getting current date and time + 1 as “20201125075901” in the format of “YYYYMMDDHHMMSS.uuuuuu”.
SELECT LOCALTIMESTAMP() + 1;
Output :
20201125075901
Example-3 :
Getting current date and time “2020-11-25 08:11:55” in the format of “YYYY-MM-DD HH-MM-SS”.
SELECT LOCALTIMESTAMP as CurrDateTime;
Output :
2020-11-25 08:11:55
Application :
This function is used to return the current date and time.
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...