ID: 40937
Updated by: [EMAIL PROTECTED]
Reported By: ctrlaltca at libero dot it
-Status: Open
+Status: Assigned
Bug Type: Date/time related
Operating System: Slackware Linux
PHP Version: 5.2.1
-Assigned To:
+Assigned To: derick
Previous Comments:
------------------------------------------------------------------------
[2007-04-04 09:47:39] ctrlaltca at libero dot it
[EMAIL PROTECTED]:~# php -r "echo date_default_timezone_get();"
Europe/Berlin
It's an alias for GMT+1
------------------------------------------------------------------------
[2007-04-03 18:52:22] [EMAIL PROTECTED]
What does the following output:
echo date_default_timezone_get(), "\n";
------------------------------------------------------------------------
[2007-03-31 17:51:15] ctrlaltca at libero dot it
sorry, i forgot to update bug summary
------------------------------------------------------------------------
[2007-03-31 17:49:20] ctrlaltca at libero dot it
First, thank you for the reply.
I tried the script:
|Sat, 31 Mar 2007 00:00:00 +0000=Sat, 31 Mar 2007 17:18:59
+0000|1174780800=1174843139|20070324 230000=20070325 171859|
I understand that strtotime($d. "-1 day") is an alias for "-24 hours",
and dst handling routines adds one more hour to compensate.
Afaik summer time begins and ends at 1:00 a.m. Universal Time (GMT) in
Europe, and at 2:00 a.m. localtime in the US. Other states do it at
midnight (example: Chile).
Trying this other script it seems that php updates the time at
midnight:
<?php
$day=24;
$mo=03;
$year=2007;
for($i=0; $i<=7; $i++)
{
$a=mktime(22, 0, 0, $mo,$day, $year);
$b=date("r",$a);
$c=strtotime($b. "+" . $i . " hour");
$curdate=date("Ymd His",$c);
echo "\n|".$b."|".$c."|".$curdate."|";
}
echo "\n";
?>
Do all we live in Chile? :) Or am i wrong again?
Thank you again for your comment, i'll use gm* class of functions.
------------------------------------------------------------------------
[2007-03-28 19:11:01] [EMAIL PROTECTED]
We are happy to tell you that you just discovered Daylight Savings
Time. For more information see:
http://webexhibits.org/daylightsaving/b.html
Instead of using mktime/date consider using gmmktime and gmdate which
do
not suffer from DST.
Try this script instead, that also shows the time to see what's
happening:
<?php
$day=date("j");
$mo=date("n");
$year=date("Y");
for($i=6; $i>=0; $i--)
{
$a=mktime(0, 0, 0, $mo,$day, $year);
$b=date("r",$a);
$c=strtotime($b. "-" . $i . " day");
$curdate=date("Ymd His",$c);
$d=date("r");
$e=strtotime($d. "-" . $i . " day");
$curdate2=date("Ymd His",$e);
echo
"\n|".$b."=".$d."|".$c."=".$e."|".$curdate."=".$curdate2."|";
}
?>
------------------------------------------------------------------------
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/40937
--
Edit this bug report at http://bugs.php.net/?id=40937&edit=1