Home >Database >Mysql Tutorial >MySQL时间戳和日期相互转化_MySQL

MySQL时间戳和日期相互转化_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-05-30 17:11:031146browse

MySQL时间戳和日期相互转化

1、UNIX_TIMESTAMP():将日期时间转换成时间戳

2、FROM_UNIXTIME():将时间戳转换成日期时间

实例:

SELECT NOW(),UNIX_TIMESTAMP(NOW()),FROM_UNIXTIME(UNIX_TIMESTAMP(NOW()));

\

 

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