且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在MySQL中将纪元数转换为人类可读的日期

更新时间:2022-12-18 11:04:16

您的纪元值1389422614485似乎具有毫秒级的精度.因此,您需要使用一些mysql数学函数以及from_unixtime()来生成人类可读的格式.

Your epoch value 1389422614485 seems like having the millisecond precision. So you need to use some mysql mathematical functions along with from_unixtime() for generating human readable format.

mysql> select from_unixtime(floor(1389422614485/1000));
+------------------------------------------+
| from_unixtime(floor(1389422614485/1000)) |
+------------------------------------------+
| 2014-01-11 12:13:34                      |
+------------------------------------------+