#45167 [Asn->Bgs]: timezones returned by datetime objects are not accepted by other functions
| From: | derick@php.net | Date: | Sun, 20 Jul 2008 21:01:11 +0000 |
| Subject: | #45167 [Asn->Bgs]: timezones returned by datetime objects are not accepted by other functions | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-127027@lists.php.net to get a copy of this message | ||
ID: 45167
Updated by: derick@php.net
Reported By: peter dot bex at solide-ict dot nl
-Status: Assigned
+Status: Bogus
Bug Type: Date/time related
Operating System: NetBSD/amd64
PHP Version: 5.2.6
Assigned To: derick
New Comment:
Marked as duplicate (bogus) for alternative bug #45543.
Previous Comments:
------------------------------------------------------------------------
[2008-06-04 12:24:35] peter dot bex at solide-ict dot nl
What this means is that there is absolutely no reliable way to use
strftime on a datetime object with a timezone like that. I've created a
feature request (45173) for a strftime method on the datetime class.
------------------------------------------------------------------------
[2008-06-04 12:07:35] derick@php.net
Type 1 = UTC offset (+02:00)
Type 2 = Timezone Abbreviation (CEST, PDT)
Type 3 = Timezone Identifier (Europe/Oslo)
You can see this back in the output of date_parse() for example.
------------------------------------------------------------------------
[2008-06-04 12:01:46] peter dot bex at solide-ict dot nl
So what's type 3 then? (and what are types 1 and 2?)
------------------------------------------------------------------------
[2008-06-04 11:54:31] derick@php.net
date_default_timezone_set() doesn't throw an exception because it's a
procedural function. Instead, it returns false in case the
$timezone_identifier is invalid.
The identifier that I meant, is one of the Timezone Identifiers that
are documented here: http://no2.php.net/timezones
------------------------------------------------------------------------
[2008-06-04 11:47:13] peter dot bex at solide-ict dot nl
Can you elaborate a bit more? Why wasn't this intended to work and what
on earth are "objects of type 3"? The "(identifiers)" note doesn't help,
since identifiers are to me names for things in a programming language
(like variable names or class name and such).
Also, shouldn't date_default_timezone_set() throw an exception in the
way that the timezone class does when you pass it an invalid timezone?
Silently ignoring the timezone and doing nothing is what caused me a lot
of frustration and confusion in tracking what was going wrong in my
script. It took me a while before I found out that this was not working
(again, it is *very* unintuitive, and IMHO it qualifies as a bug).
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/45167
--
Edit this bug report at http://bugs.php.net/?id=45167&edit=1