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

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

WBOY
Release: 2016-05-30 17:11:03
Original
1118 people have browsed it

MySQL时间戳和日期相互转化

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

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

实例:

SELECT NOW(),UNIX_TIMESTAMP(NOW()),FROM_UNIXTIME(UNIX_TIMESTAMP(NOW()));
Copy after login

\

 

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template