【发布时间】:2011-02-08 17:29:25
【问题描述】:
我有一些使用unixtime 的数据。我正在使用 Python 和 MySQL。
我注意到 MySQL GUI 工具函数 from_unixtime() 不等于 Python 的输出 time.ctime() 甚至 MySQL 命令行界面...
MySQL 命令行:
#This returns the correct time
mysql> select from_unixtime(1295147016.45300);
+---------------------------------+
| from_unixtime(1295147016.45300) |
+---------------------------------+
| 2011-01-15 21:03:36 |
+---------------------------------+
1 row in set (0.05 sec)
MySQL GUI 工具:
# Incorrect Time!
select from_unixtime(1295147016.45300);
2011-01-16 03:03:36
Python:
#This returns the correct time
>>> import time
>>> time.ctime(1295147016.45300)
'Sat Jan 15 21:03:36 2011'
有人可以解释一下这些差异吗?如果 GUI 不能显示正确的数据,那么它还有什么意义呢。
谢谢,
M
【问题讨论】:
标签: python mysql time unix-timestamp