开发者

MySQL select timestamp as date string

I have a table with the column create_time which is of type INTEGER and represents the time since epoch.

I'd like to select all rows and colu开发者_JAVA技巧mns, while displaying this row as a date/time in UTC format.

How do I do that?


Use FROM_UNIXTIME to convert seconds since epoch to a DATETIME, which also allows you specify a format:

FROM_UNIXTIME(create_time, '%Y-%m-%d %H:%i:%s')
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜