|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2014-03-30 20:13 UTC] evert at rooftopsolutions dot nl
Description:
------------
Sample code attached. Note that this worked before 5.5.10.
Perhaps I took advantage of a feature that was not supposed to be supported, in which case I would definitely appreciate a workaround that works pre and post 5.5.10 :)
Test script:
---------------
php -r "echo (new DateTimeZone('EST5EDT'))->getName();";
Expected result:
----------------
EST5EDT
Actual result:
--------------
Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct(): Unknown or bad timezone (EST5EDT)' in Command line code on line 1
Exception: DateTimeZone::__construct(): Unknown or bad timezone (EST5EDT) in Command line code on line 1
Call Stack:
0.0001 221064 1. {main}() Command line code:0
0.0001 221296 2. DateTimeZone->__construct() Command line code:1
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 14:00:01 2025 UTC |
Derick, wouldn't the easiest solution just be to add these to timezonemap.h? As in, for EST5EDT it would be something like: { "edt", 1, -14400, "EST5EDT" }, { "est", 1, -18000, "EST5EDT" },Hrm.. In my simple test it worked. It was zone_search() that was failing. With that hack this works fine: $tz = new DateTimeZone('EST5EDT'); echo $tz->getName()."\n"; $date = new DateTime('2000-01-01', $tz); $date = $date->modify('+6 months'); echo $date->format('Y-m-d') . "\n"; But true, looking closer at it, $tz->getTranstitions() doesn't return anything.