跟进https://serverfault.com/questions/191331/should-servers-have-their-timezone-set-to-gmt-utc的问题
MySQL时区应该设置为UTC还是应该设置为与服务器或PHP设置相同的时区?(如果不是UTC)
优缺点都有什么?
这是一个测试代码:
<?php
ini_set('date.timezone', 'Europe/London');
$dt = new \DateTime('0000-00-00 00:00:00');
var_dump($dt);
Run Code Online (Sandbox Code Playgroud)
这提供:
object(DateTime)[1]
public 'date' => string '-0001-11-30 00:00:00' (length=20)
public 'timezone_type' => int 3
public 'timezone' => string 'Europe/London' (length=13)
Run Code Online (Sandbox Code Playgroud)
而这不是有效日期.我不明白返回的价值,特别是月份......你能解释一下吗?