Mysql date and time stamp into each other

 

SELECT CURDATE (); # Get the current date , examples: 2019-10-29 
SELECT UNIX_TIMESTAMP (CURDATE ()); # converting the format of the current time stamp , an example: a 2019-10-29 converted into 1572278400

SELECT FROM_UNIXTIME (UNIX_TIMESTAMP (CURDATE ())) ; # converting the timestamp of the current time format , the example: to convert the results 1572278400 2019-10-29 00:00:00

SELECT
FROM_UNIXTIME (UNIX_TIMESTAMP (CURDATE ()), ' % Y-M-% D% ' ); # the current time stamp is converted to the format, and the date can be displayed only , example: 1572278400 conversion result 2019 -10-29

 

Guess you like

Origin www.cnblogs.com/syw20170419/p/11761866.html