Home >Database >Mysql Tutorial >格式化时间戳为日期格式 如,'%Y-%m-%d'类型

格式化时间戳为日期格式 如,'%Y-%m-%d'类型

WBOY
WBOYOriginal
2016-06-07 14:57:223919browse

FROM_UNIXTIME(时间戳,格式类型)格式化时间戳为日期格式如,%Y-%m-%d类型 UNIX_TIMESTAMP(日期类型)格式化日期为时间戳格式 MySQL SELECT id, title,createdate,FROM_UNIXTIME(UNIX_TIMESTAMP(createdate),'%Y-%m-%d') AS createdate

FROM_UNIXTIME(时间戳,格式类型)   格式化时间戳为日期格式 如,'%Y-%m-%d'类型
UNIX_TIMESTAMP(日期类型)  格式化日期为时间戳格式
MySQL
SELECT id, title,createdate,FROM_UNIXTIME(UNIX_TIMESTAMP(createdate),'%Y-%m-%d') AS createdate
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn