|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2017-05-09 13:57 UTC] schmidt@php.net
Description: ------------ According to the documentation, DateTimeZone::getLocation() returns an array. However, it returns false when using an unnamed timezone. I would expect it to return an array with dummy values similar to that returned for e.g. Etc/UTC+2. See also bug 67256 about DateTimeZone::getTransitions(). Test script: --------------- $dt = new DateTime('2017-01-01 12:00+00:00'); var_dump($dt->getTimezone()->getLocation()); Expected result: ---------------- array(4) { ["country_code"]=> string(2) "??" ["latitude"]=> float(0) ["longitude"]=> float(0) ["comments"]=> string(0) "" } Actual result: -------------- bool(false) PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 06 11:00:01 2025 UTC |
If this behaviour is intentional, at least the documentation needs to be updated. However, I think the current behaviour is rather confusing. I understand that DateTimeZone internally has a timezone_type property, but this is not very explicitly described in the documentation. From a UX point of view, I would expect new DateTime('2017-01-01 12:00 Etc/GMT'), new DateTime('2017-01-01 12:00Z'), new DateTime('2017-01-01 12:00 UTC') and new DateTime('2017-01-01 12:00+00:00') to have the same location.