Half hour time zones missing

后端 未结 3 1859
北海茫月
北海茫月 2021-01-20 02:34

In PHP I am using DateTimeZone::listIdentifiers() to get a list of time zones for user selection. This seems to be working fine, but missing from this list are

相关标签:
3条回答
  • 2021-01-20 02:53

    It seems I overlooked a few of the half hour timezones when scanning the list of 420 or so. The end result of this is that, yes the timezones are there. In the IANA list they all changed away from their historic names.

    There seems to be a subtle distinction in how IANA meant the linked timezones to be used and how PHP implemented it exactly that is now in the realm of "definitely not a bug, but clear as mud in the docs" and that has a sort of solution.

    https://bugs.php.net/bug.php?id=66102

    This Github search made it much clearer also: https://github.com/eggert/tz/search?utf8=%E2%9C%93&q=Newfoundland

    So, they are there. I still have some concerns about usability and whether our users will understand to choose America/St_Johns and the like when looking for their timezones. We are doing some research with our users about that.

    0 讨论(0)
  • 2021-01-20 02:54

    Just guessing here, but it looks like the default $what parameter is DateTimeZone::ALL, and you want to use identifiers that only exist now for backwards compatibility - so you should use DateTimeZone::ALL_WITH_BC:

    print_r(DateTimeZone::listIdentifiers(DateTimeZone::ALL_WITH_BC));
    

    Note that the manual does say not to use them.

    In the case of Iran, you could replace it with the Asia/Tehran time zone for example.

    0 讨论(0)
  • 2021-01-20 03:16

    For example:

    Newfoundland time zone identifier is America/St_Johns

    [1] http://php.net/manual/en/timezones.america.php

    [2] https://en.wikipedia.org/wiki/List_of_tz_database_time_zones

    0 讨论(0)
提交回复
热议问题