Home >Database >Mysql Tutorial >How to convert timestamp to date in mysql
Mysql method to convert timestamp to date: use function [FROM_UNIXTIME()], the code is [select FROM_UNIXTIME(1429063399,'%Y year %m month %d day')].
Mysql method to convert timestamp to date:
1. Convert timestamp to date
Function: FROM_UNIXTIME()
select FROM_UNIXTIME(1429063399,'%Y年%m月%d日')
The result is: April 15, 2015
2. Convert the date to a timestamp, which is exactly the opposite of FROM_UNIXTIME
Function : UNIX_TIMESTAMP()
select UNIX_TIMESTAMP('2015-04-15')
The result is: 1429027200
Related free learning recommendations: mysql database (video)
The above is the detailed content of How to convert timestamp to date in mysql. For more information, please follow other related articles on the PHP Chinese website!