1

是否有一个 MySQL 函数可以将时间戳转换为datetime. 我尝试了以下方法:

SELECT FROM_UNIXTIME(1337951145000);

但它返回null。

4

3 回答 3

2

你的时间戳太长,试试

SELECT FROM_UNIXTIME(1337951145);

或者

SELECT FROM_UNIXTIME(1337951145.000);
于 2012-05-25T15:11:55.907 回答
1

Your timestamp is valid ok.

Currently, timestamps are either 10 or 13 digits. 13-digit Timestamps (such as yours) have an additional 3-digit microseconds.

But to my (Google's) knowledge, MySQL's functions only supports the short 32bit timestamp (and you are not the only one to hit this wall.

Hopefully they'll sort it out before 2038.

于 2013-07-03T19:58:27.393 回答
1

最大可表示时间为 2038-01-19。在 03:14:07 UTC,您的时间戳已经结束。

于 2012-05-25T15:13:45.973 回答