Home » Date and Time » Date » Bug #7225
Date and TimeZone
Details
| Submitted | 2006-03-28 10:51 UTC |
|---|---|
| From | jean-michel dot ramseyer at rbs dot fr |
| Assigned | pajoye |
| Status | Closed |
| Package | Date |
| PHP Version | 5.1.1 |
| OS | Debian |
| Roadmaps | (Not assigned) |
Comments
[2006-03-28 10:51 UTC] jean-michel dot ramseyer at rbs dot fr
Description:
------------
Hi,
We change time zone this weekend from CET to CEST and when I try to compare an old Date with a new Date with after() or before() methods I get the following PHP notices :
Notice: mktime() [function.mktime]: Timezone setting (date.timezone) or TZ environment variable contains an unknown timezone in Date.php on line 267
Notice: localtime() [function.localtime ]: Timezone setting (date.timezone) or TZ environment variable contains an unknown timezone in TimeZone.php on line 268
Here is the dump from my D_TZ object :
object(Date_TimeZone)#164 (8) {
["id"]=> string(4) "CEST"
["longname"]=> string(21) "Central European Time"
["shortname"]=> string(3) "CET"
["hasdst"]=> bool(true)
["dstlongname"]=> string(28) "Central European Summer Time"
["dstshortname"]=> string(4) "CEST"
["offset"]=> int(3600000)
["default"]=> NULL
}
Test script:
---------------
Sample of code with notices:
$l_current = new Date();
$l_end = new Date();
$l_end->setDate("2006-03-15 00:00:00");
return $l_end->after($l_current);
Code for not having notices :
$l_current = new Date();
$l_end = new Date();
$l_end->setDate("2006-03-15 00:00:00");
$l_end->setTz(new Date_TimeZone(null));
return $l_end->after($l_current);
[2007-10-06 07:48 UTC] jean-michel dot ramseyer at rbs dot fr
This is not a bug of course ; it' a problem on the server configuration. But if somebody has the same problemn one day on a mutualised server and doesn't have access to server conf ; this may be the best way for solving such troubles