mysql将bigint转换为datetime

时间:2016-06-10 18:49:46

标签: mysql bigint

表中的CreateDateTime列的格式为bigint(20)。例如它看起来像:131037078373067074。我没有创建这个表,它传递给我。

使用此处的示例Convert BigInt timestamp to a real Date with row aggregation and operations in mySQL,我尝试将CreateDateTime除以POW(10,8)POW(10,9)

SELECT FROM_UNIXTIME(CreateDateTime/POW(10,8)) AS due_date 
FROM  images;

结果看起来像' 2011-07-11 02:53:03.730671'。

SELECT FROM_UNIXTIME(CreateDateTime/POW(10,9)) AS due_date 
FROM  images;

结果看起来像1974-02-25 09:11:18.373067'。

我预计2016年会有一个日期。但是,将CreateDateTime除以POW(10,7)会给出null。

我该怎么办?

0 个答案:

没有答案