Keep in mind that at least with version 5.3.3, ETC/GMT+5 in fact refers to GMT-5 and ETC/GMT-5 refers to GMT+5. I would suppose it's the same for other timezone. This might have been corrected in newer versions.
Proof:
<?php
$tz = new DateTimeZone("Etc/GMT-5");
$transitions = $tz->getTransitions();
echo $transitions[0]["offset"];
// returns 18000
$tz = new DateTimeZone("Etc/GMT+5");
$transitions = $tz->getTransitions();
echo $transitions[0]["offset"];
// returns -18000
$tz = new DateTimeZone("US/Eastern"); // which is in fact GMT-5 and not GMT+5 during the winter
$transitions = $tz->getTransitions(1293840000); // that's 2011-01-01 00:00:00 GMT, guaranteed to be in winter time in US/Eastern
echo $transitions[0]["offset"];
// returns -18000
?>
Like I said, it might be fixed in newer versions
The DateTimeZone class
(PHP 5 >= 5.2.0)
Introduction
Representation of time zone.
Class synopsis
DateTimeZone
{
/* Constants */
/* Methods */
}Predefined Constants
-
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.
Table of Contents
- DateTimeZone::__construct — Creates new DateTimeZone object
- DateTimeZone::getLocation — Returns location information for a timezone
- DateTimeZone::getName — Returns the name of the timezone
- DateTimeZone::getOffset — Returns the timezone offset from GMT
- DateTimeZone::getTransitions — Returns all transitions for the timezone
- DateTimeZone::listAbbreviations — Returns associative array containing dst, offset and the timezone name
- DateTimeZone::listIdentifiers — Returns numerically index array with all timezone identifiers
Aurelien Marchand
08-Dec-2011 09:11
