开发者

MySQL select timestamp as date string

开发者 https://www.devze.com 2023-01-13 18:26 出处:网络
I have a table with the column create_time which is of type INTEGER and represents the time since epoch.

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

精彩评论

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

关注公众号