©
Ce document utilise Manuel du site Web PHP chinois Libérer
(PHP 5 >= 5.2.0, PHP 7)
Representation of time zone.
$timezone
)$datetime
)$timestamp_begin
[, int $timestamp_end
]] )$what
= DateTimeZone::ALL
[, string $country
= NULL
]] )DateTimeZone::AFRICA
Africa time zones.
DateTimeZone::AMERICA
America time zones.
DateTimeZone::ANTARCTICA
Antarctica time zones.
DateTimeZone::ARCTIC
Arctic time zones.
DateTimeZone::ASIA
Asia time zones.
DateTimeZone::ATLANTIC
Atlantic time zones.
DateTimeZone::AUSTRALIA
Australia time zones.
DateTimeZone::EUROPE
Europe time zones.
DateTimeZone::INDIAN
Indian time zones.
DateTimeZone::PACIFIC
Pacific time zones.
DateTimeZone::UTC
UTC time zones.
DateTimeZone::ALL
All time zones.
DateTimeZone::ALL_WITH_BC
All time zones including backwards compatible.
DateTimeZone::PER_COUNTRY
Time zones per country.
[#1] ryan at amst dot com [2015-08-21 19:45:55]
It seems like as of PHP 5.5, creating a new DateTimeZone with a string like 'EDT' will cause DateTimeZone::getName() to return 'EDT' whereas prior to 5.5 it would convert it would have returned 'America/New_York'
This is of particular note when using a DateTimeZone object to change the timezone on a DateTime object. Using a DateTimeZone object when set as shown above will cause the conversion to be wrong without throwing any errors.