Skip to content

MySQL from_unixtime 函数

from_unixtime 函数可以将 unix 时间戳转换为年月日时分秒格式。

示例:

SQL执行结果
select from_unixtime(1546698576);2019-01-05 22:29:36
select from_unixtime(1546698576, '%Y-%m-%d %H:%i:%S');2019-01-05 22:29:36
select from_unixtime(1546698576, '%Y-%m-%d');2019-01-05