php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60332 timezone_abbreviations_list() returns incorrect time offset
Submitted: 2011-11-19 01:57 UTC Modified: 2012-03-22 23:18 UTC
From: nazar-pc at yandex dot ru Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.3.6 OS: Ubuntu Linux 11.10
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: nazar-pc at yandex dot ru
New email:
PHP Version: OS:

 

 [2011-11-19 01:57 UTC] nazar-pc at yandex dot ru
Description:
------------
---
From manual page: http://www.php.net/datetimezone.listabbreviations
---

Function timezone_abbreviations_list() returns incorrect values of time offset.
For example, I live in Ukraine, Kiev (timezone Europe/Kiev) with time offset +2 hours, but function returns value, that equals to +2:02:04 (in seconds 7324), similar problems are for other timezones.
Other cities in my country has the same offset +2 hours, but function returns other values from interval +2 till +3 hours, why?

But functions, which works with time after changing of timezone return correct values, so, the problem is only in this function.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-11-19 01:59 UTC] nazar-pc at yandex dot ru
PHP version corrected
 [2011-11-19 01:59 UTC] nazar-pc at yandex dot ru
-PHP Version: 5.3.8 +PHP Version: 5.3.6
 [2012-03-22 21:27 UTC] jdmcadam at hotmail dot com
The documentation on this isn't very clear, but the array that is returned has multiple timezones for most locations, organized by timezone abbreviation (ex CET, GMT, PST). In this case, Europe/Kiev shows up under 7 different timezones with offsets ranging from UTC+1 (no DST) to UTC+4. One of these is mean solar time which, for Kiev, is UTC +7324 seconds (based on distance from 0 deg of longitude). At 24hrs = 360°, 7324sec = 30.51667°E, which runs straight through Kiev.
 [2012-03-22 21:40 UTC] nazar-pc at yandex dot ru
But why it returns mean solar time?
After changing of timezone to Europe/Kiev, time on site offsets on +2 hours, and it is obvious, that I expect to obtain the same value in returned array, but observe such unexpected behaviour (who needs this?).

So, if this function returns mean solar time, how to get true time offsets for each timezone correctly?
 [2012-03-22 23:18 UTC] derick@php.net
-Status: Open +Status: Not a bug
 [2012-03-22 23:18 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

It also tells you between which timestamps those UTC offsets were valid. If you run zdump -v Europe/Kiev on the command line, you get the same output:

Europe/Kiev  Wed Dec 31 21:57:55 1879 UTC = Wed Dec 31 23:59:59 1879 LMT isdst=0 gmtoff=7324
Europe/Kiev  Wed Dec 31 21:57:56 1879 UTC = Thu Jan  1 00:00:00 1880 KMT isdst=0 gmtoff=7324
Europe/Kiev  Thu May  1 21:57:55 1924 UTC = Thu May  1 23:59:59 1924 KMT isdst=0 gmtoff=7324
Europe/Kiev  Thu May  1 21:57:56 1924 UTC = Thu May  1 23:57:56 1924 EET isdst=0 gmtoff=7200
Europe/Kiev  Fri Jun 20 21:59:59 1930 UTC = Fri Jun 20 23:59:59 1930 EET isdst=0 gmtoff=7200
Europe/Kiev  Fri Jun 20 22:00:00 1930 UTC = Sat Jun 21 01:00:00 1930 MSK isdst=0 gmtoff=10800
Europe/Kiev  Fri Sep 19 20:59:59 1941 UTC = Fri Sep 19 23:59:59 1941 MSK isdst=0 gmtoff=10800
Europe/Kiev  Fri Sep 19 21:00:00 1941 UTC = Fri Sep 19 23:00:00 1941 CEST isdst=1 gmtoff=7200
Europe/Kiev  Mon Nov  2 00:59:59 1942 UTC = Mon Nov  2 02:59:59 1942 CEST isdst=1 gmtoff=7200
Europe/Kiev  Mon Nov  2 01:00:00 1942 UTC = Mon Nov  2 02:00:00 1942 CET isdst=0 gmtoff=3600
Europe/Kiev  Mon Mar 29 00:59:59 1943 UTC = Mon Mar 29 01:59:59 1943 CET isdst=0 gmtoff=3600
Europe/Kiev  Mon Mar 29 01:00:00 1943 UTC = Mon Mar 29 03:00:00 1943 CEST isdst=1 gmtoff=7200
Europe/Kiev  Mon Oct  4 00:59:59 1943 UTC = Mon Oct  4 02:59:59 1943 CEST isdst=1 gmtoff=7200
Europe/Kiev  Mon Oct  4 01:00:00 1943 UTC = Mon Oct  4 02:00:00 1943 CET isdst=0 gmtoff=3600
Europe/Kiev  Fri Nov  5 22:59:59 1943 UTC = Fri Nov  5 23:59:59 1943 CET isdst=0 gmtoff=3600
Europe/Kiev  Fri Nov  5 23:00:00 1943 UTC = Sat Nov  6 02:00:00 1943 MSK isdst=0 gmtoff=10800
Europe/Kiev  Tue Mar 31 20:59:59 1981 UTC = Tue Mar 31 23:59:59 1981 MSK isdst=0 gmtoff=10800
Europe/Kiev  Tue Mar 31 21:00:00 1981 UTC = Wed Apr  1 01:00:00 1981 MSD isdst=1 gmtoff=14400
Europe/Kiev  Wed Sep 30 19:59:59 1981 UTC = Wed Sep 30 23:59:59 1981 MSD isdst=1 gmtoff=14400
Europe/Kiev  Wed Sep 30 20:00:00 1981 UTC = Wed Sep 30 23:00:00 1981 MSK isdst=0 gmtoff=10800
Europe/Kiev  Wed Mar 31 20:59:59 1982 UTC = Wed Mar 31 23:59:59 1982 MSK isdst=0 gmtoff=10800
Europe/Kiev  Wed Mar 31 21:00:00 1982 UTC = Thu Apr  1 01:00:00 1982 MSD isdst=1 gmtoff=14400
...
Europe/Kiev  Sun Mar 27 00:59:59 2011 UTC = Sun Mar 27 02:59:59 2011 EET isdst=0 gmtoff=7200
Europe/Kiev  Sun Mar 27 01:00:00 2011 UTC = Sun Mar 27 04:00:00 2011 EEST isdst=1 gmtoff=10800
Europe/Kiev  Sun Oct 30 00:59:59 2011 UTC = Sun Oct 30 03:59:59 2011 EEST isdst=1 gmtoff=10800
Europe/Kiev  Sun Oct 30 01:00:00 2011 UTC = Sun Oct 30 03:00:00 2011 EET isdst=0 gmtoff=7200
Europe/Kiev  Sun Mar 25 00:59:59 2012 UTC = Sun Mar 25 02:59:59 2012 EET isdst=0 gmtoff=7200
Europe/Kiev  Sun Mar 25 01:00:00 2012 UTC = Sun Mar 25 04:00:00 2012 EEST isdst=1 gmtoff=10800
Europe/Kiev  Sun Oct 28 00:59:59 2012 UTC = Sun Oct 28 03:59:59 2012 EEST isdst=1 gmtoff=10800
Europe/Kiev  Sun Oct 28 01:00:00 2012 UTC = Sun Oct 28 03:00:00 2012 EET isdst=0 gmtoff=7200
Europe/Kiev  Sun Mar 31 00:59:59 2013 UTC = Sun Mar 31 02:59:59 2013 EET isdst=0 gmtoff=7200


It just shows that in the past, it was different.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed May 07 15:01:31 2025 UTC