把UTC/GMT(伦敦)时间字符串转成中国时间

四月 29th, 2008 by xLight

今天第一次知道UTC时间竟然还有夏令时,这不是添乱嘛。
原来写的代码转换时区时都是用timestamp +3600*8 。。

function conventDateTime_UTCtoChina($strDatetime){
date_default_timezone_set(’Europe/London’);
$t = strtotime($strDateTime);
date_default_timezone_set(’Asia/Shanghai’);
return date(’Y-m-d H:i:s’,$t );
}


0 Responses to “把UTC/GMT(伦敦)时间字符串转成中国时间”

  1. No Comments

Leave a Reply

提示:如果你刚刚提交过评论,但是还没有被显示出来,请点击这里刷新一下: 刷新评论