[转]Mysql FROM_UNIXTIME as UTC

本文转自:https://stackoverflow.com/questions/18276768/mysql-from-unixtime-as-utc

 

You would be better off setting the time zone ahead of time:

SET time_zone='UTC';
select FROM_UNIXTIME(1277942400);



SELECT CONVERT_TZ(FROM_UNIXTIME(1277942400), @@session.time_zone,'UTC')



SELECT @@global.time_zone, @@session.time_zone;


time_zone = '+00:00'


date_default_timezone_set("Asia/Shanghai");
 
 

 

posted on 2018-11-15 14:54  freeliver54  阅读(226)  评论(0编辑  收藏  举报

导航