Home > Database > Mysql Tutorial > mysql时间转换语句_MySQL

mysql时间转换语句_MySQL

WBOY
Release: 2016-06-01 13:39:00
Original
1129 people have browsed it

bitsCN.com


mysql时间转换语句

 

mysql> select UNIX_TIMESTAMP();  

-> 882226357  

mysql> select UNIX_TIMESTAMP('1997-10-04 22:23:00');  

-> 875996580  

 

当UNIX_TIMESTAMP被用于一个TIMESTAMP列,函数将直接接受值,

没有隐含的“string-to-unix-timestamp”变换。 

FROM_UNIXTIME(unix_timestamp)  

以'YYYY-MM-DD HH:MM:SS'或YYYYMMDDHHMMSS格式返回unix_timestamp

参数所表示的值,取决于函数是在一个字符串还是或数字上下文中被使用。  

 

mysql> select FROM_UNIXTIME(875996580);  

-> '1997-10-04 22:23:00'  

mysql> select FROM_UNIXTIME(875996580) + 0;  

-> 19971004222300 
 

bitsCN.com
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