使用datetime插入日期gmt

时间:2012-10-20 18:10:38

标签: php

如何更改此设置,以便时间为GMT,日期正确,但时间错误。

任何帮助都会感激不尽,谢谢

function format_mysql_datetime($raw) {
    $format = '%Y-%m-%d %H:%M:%S';
    $stringtime =  strtotime($raw);
    return strftime($format, $stringtime);  
}

$raw = date('c');

mysql_query("INSERT INTO `Cars` VALUES ('', 'Pending', '$price', '{$fetchAccount['email']}', '$raw', '$content', '$description', '$area', '$town', '$UK', '$target', '0')") ; 

1 个答案:

答案 0 :(得分:0)

问题在于时区

使用此

date_default_timezone_set('GMT'); 
相关问题