Doc #74324 [Com]: DateTimeZone supported timezone names

From: Date: Tue, 28 Mar 2017 08:58:51 +0000
Subject: Doc #74324 [Com]: DateTimeZone supported timezone names
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-14550@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74324&edit=1 ID: 74324 Comment by: graeme dot chapman at infinitycloud dot com Reported by: graeme dot chapman at infinitycloud dot com Summary: DateTimeZone supported timezone names Status: Verified Type: Documentation Problem Package: Date/time related Operating System: Ubuntu PHP Version: 5.6.30 Block user comment: N Private report: N New Comment: @requinix Makes sense. Think this needs a little update to the docs to clarify this though! Previous Comments: ------------------------------------------------------------------------ [2017-03-28 08:39:19] requinix@php.net timelib (which PHP uses) explicitly supports offset notation in addition to the usual named timezones; see the "tzcorrection" format in http://php.net/manual/en/datetime.formats.time.php Ref: https://github.com/php/php-src/blob/PHP-5.6.30/ext/date/lib/parse_date.re#L746 https://github.com/php/php-src/blob/PHP-5.6.30/ext/date/lib/timelib.c#L311 ------------------------------------------------------------------------ [2017-03-28 08:12:07] graeme dot chapman at infinitycloud dot com Description: ------------ --- From manual page: http://www.php.net/datetimezone.construct --- The documentation states that the DateTimeZone constructor accepts 'One of the supported timezone names(http://php.net/manual/en/timezones.php).' However, it also appears to accept offset values. Unsure if this is expected but undocumented behaviour, or a bug. In PHP 5.5.9 this throws an exception. Test script: --------------- var_dump(new DateTimeZone('+0200')); Expected result: ---------------- Uncaught exception 'Exception' with message 'DateTimeZone::__construct(): Unknown or bad timezone (+0200)' Actual result: -------------- object(DateTimeZone)#1 (2) { ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=74324&edit=1

« previous php.doc.bugs (#14550) next »