码迷,mamicode.com
首页 > 数据库 > 详细

MySQL中from_unixtime与unix_timestamp差别

时间:2014-07-23 17:39:21      阅读:268      评论:0      收藏:0      [点我收藏+]

标签:style   http   color   os   width   io   

查阅官档:

 FROM_UNIXTIME(unix_timestamp)FROM_UNIXTIME(unix_timestamp,format)

Returns a representation of the unix_timestamp argument as a value in ‘YYYY-MM-DD HH:MM:SS‘ orYYYYMMDDHHMMSS format, depending on whether the function is used in a string or numeric context. The value is expressed in the current time zone. unix_timestamp is an internal timestamp value such as is produced by theUNIX_TIMESTAMP() function.

说明from_unixtime只是按照当前的时区,已指定的形式返回unix_timestamp值。

 UNIX_TIMESTAMP()UNIX_TIMESTAMP(date)

If called with no argument, returns a Unix timestamp (seconds since ‘1970-01-01 00:00:00‘ UTC) as an unsigned integer. If UNIX_TIMESTAMP() is called with a date argument, it returns the value of the argument as seconds since ‘1970-01-01 00:00:00‘ UTC. date may be a DATE string, a DATETIME string, a TIMESTAMP, or a number in the format YYMMDD or YYYYMMDD. The server interprets date as a value in the current time zone and converts it to an internal value in UTC

不同点在与,unix_timestamp会受到本地时区的影响,有可能2个不同的timstamp对应一个unixtimestamp,而from_unixtime则是一一对应


MySQL中from_unixtime与unix_timestamp差别,布布扣,bubuko.com

MySQL中from_unixtime与unix_timestamp差别

标签:style   http   color   os   width   io   

原文地址:http://my.oschina.net/u/1440383/blog/294141

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!