#39050 [Opn->Bgs]: Etc/GMT+/- x hours values are backwards

From: Date: Thu, 05 Oct 2006 16:29:46 +0000
Subject: #39050 [Opn->Bgs]: Etc/GMT+/- x hours values are backwards
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-103152@lists.php.net to get a copy of this message
ID: 39050 Updated by: derick@php.net Reported By: duerra_NOT_THIS_ at pushitlive dot net -Status: Open +Status: Bogus Bug Type: Date/time related Operating System: Linux PHP Version: 5.1.6 New Comment: Your OS does the same for example: derick@kossu:~$ TZ=UTC date Thu Oct 5 16:26:02 UTC 2006 derick@kossu:~$ TZ=GMT-2 date Thu Oct 5 18:26:07 GMT 2006 derick@kossu:~$ TZ=GMT+6 date Thu Oct 5 10:26:11 GMT 2006 The explanation (from the timezone database definition files) why it is like this: # We use POSIX-style signs in the Zone names and the output abbreviations, # even though this is the opposite of what many people expect. # POSIX has positive signs west of Greenwich, but many people expect # positive signs east of Greenwich. For example, TZ='Etc/GMT+4' uses # the abbreviation "GMT+4" and corresponds to 4 hours behind UTC # (i.e. west of Greenwich) even though many people would expect it to # mean 4 hours ahead of UTC (i.e. east of Greenwich). The timezones you can specify in PHP come directly from this database, just like it would have been before (in PHP 4 and 5.0). They also do not take care of daylight savingstime either so they're definitely not useful and concise. Nothing in PHP is deprecated either as before you'd do this with the putenv("TZ=xxx") env var which would have given you the exact same result. Definitely a bogus bug. Previous Comments: ------------------------------------------------------------------------ [2006-10-05 16:06:20] duerra_NOT_THIS_ at pushitlive dot net How is that correct? My time zone is GMT-6 hours, not GMT+6 hours. I even noticed that it is noted in the user-contributed notes as being backwards. Also, I realize that I "should not be using" those values according to the documentation, but PHP depricating those is lunacy, because having a select dropdown of hundreds of locations/cities for an end user to pick from for locale reasons is confusing and tedius. Those values should not be depricated - they are useful, minimal, and concise. The same cannot be said about selecting a city out of hundreds of cities worldwide. Sure it is valid and useful for some instances, but definitely not for time zone configuration for end users on a site - and nor is developing a workaround system because useful features are depricated in the language. I can understand depricating other values but not the Etc/GMT* values. PHP really needs to reconsider this. I also still do not understand how the values provided with those settings are the correct values. GMT-6 hours would be US/Central, but I'm given the value of somewhere in Australia. That is not correct. ------------------------------------------------------------------------ [2006-10-05 14:34:46] derick@php.net No, those are correct. However, you should not even be using those - they only exist in the timezone database for backward compatible reasons. Pick one of the Continent/City combinations. ------------------------------------------------------------------------ [2006-10-05 14:28:38] duerra_NOT_THIS_ at pushitlive dot net Description: ------------ When using Etc/GMT related values with date_default_timezone_set(), the values are backwards of what they should be. Reproduce code: --------------- <?php date_default_timezone_set('Etc/GMT'); echo date('H:i').'<br />'; date_default_timezone_set('Etc/GMT-1'); echo date('H:i'); ?> Expected result: ---------------- 14:27 13:27 Actual result: -------------- 14:27 15:27 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=39050&edit=1

« previous php.bugs (#103152) next »