Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/295.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
php文件中的时区_Php_Mysql_Sql - Fatal编程技术网

php文件中的时区

php文件中的时区,php,mysql,sql,Php,Mysql,Sql,我有一个xml格式的pubDate,我必须将其写入mysql数据库-一切正常,但时区有问题: date_default_timezone_set('Europe/Warsaw'); $date = date("Y-m-d H:i:s", strtotime($entry->pubDate)); xml文件中的数据: Sat,2017年9月2日20:41:30+0000 数据库中的分数: 2017-09-02 22:41:30 正如您所看到的,差异是两个小时,但我不知道它是什么以及如何获得

我有一个xml格式的pubDate,我必须将其写入mysql数据库-一切正常,但时区有问题:

date_default_timezone_set('Europe/Warsaw');
$date = date("Y-m-d H:i:s", strtotime($entry->pubDate));
xml文件中的数据:

Sat,2017年9月2日20:41:30+0000

数据库中的分数: 2017-09-02 22:41:30
正如您所看到的,差异是两个小时,但我不知道它是什么以及如何获得正确的效果。

您的数据库时区是什么?尝试此请求选择@@global.time_zone、@@session.time_zone;可能您还需要更改mysql时区

您也必须为mysql设置时区。

返回系统系统-系统时区设置良好。此符号有问题,Sat,2017年9月2日20:41:30+0000。应为2017年9月2日星期六20:41:30+01