0
好的,我很難過。以下是我擁有的兩個日期對象:
// $startDate value
DateTime::__set_state(array(
'date' => '2017-11-05 00:00:00.000000',
'timezone_type' => 3,
'timezone' => 'America/Chicago',
))
// $endDate value
DateTime::__set_state(array(
'date' => '2017-11-05 23:59:00.000000',
'timezone_type' => 3,
'timezone' => 'America/Chicago',
))
它們都具有完全相同的時區信息。但是,當我運行$startDate->format(DateTime::ISO8601)
和$endDate->format(DateTime::ISO8601)
我得到不同的時區偏移量。
// $startDate->format(DateTime::ISO8601)
2017-11-05T00:00:00-0500
// $endDate->format(DateTime::ISO8601)
2017-11-05T23:59:00-0600
任何想法是什麼可能造成這種情況?
11月5日是DST結束的日子,因此UTC偏移量會發生變化。 – aynber