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')
精彩评论