Mombu the Php Forum sponsored links

Go Back   Mombu the Php Forum > Php > #40937 : date() and dst update
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 16th July 05:29
php-bugs
External User
 
Posts: 1
Default #40937 : date() and dst update



ID: 40937
User updated by: ctrlaltca at libero dot it
-Summary: date() lose Sundays
Reported By: ctrlaltca at libero dot it
-Status: Bogus
+Status: Open
Bug Type: Date/time related
Operating System: Slackware Linux
PHP Version: 5.2.1
New Comment:

sorry, i forgot to update bug summary


Previous Comments:
------------------------------------------------------------------------

[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] derick@php.net

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."=".$cu rdate2."|";

}
?>


------------------------------------------------------------------------

[2007-03-28 15:21:00] ctrlaltca at libero dot it

Description:
------------
It seems that the date() function "jumps over" sundays when converting
timestamps not referring to midnight.
Similar to #461


Reproduce code:
---------------
<?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",$c);

$d=date("r");
$e=strtotime($d. "-" . $i . " day");
$curdate2=date("Ymd",$e);
echo
"\n|".$b."=".$d."|".$c."=".$e."|".$curdate."=".$cu rdate2."|";

}
?>

Expected result:
----------------
I expect this script to return the right "Ymd" dates of the last seven
days.

Actual result:
--------------
It works:
|Wed, 28 Mar 2007 00:00:00 +0200=Wed, 28 Mar 2007 17:13:37
+0200|1175032800=1175094817|20070328!=20070328|
but when it finds a sunday, dates are shifted off of 1 day:
|Wed, 28 Mar 2007 00:00:00 +0200=Wed, 28 Mar 2007 17:13:37
+0200|1174773600=1174835617|20070324!=20070325|

------------------------------------------------------------------------


--
Edit this bug report at http://bugs.php.net/?id=40937&edit=1
  Reply With Quote


  sponsored links


2 16th July 11:26
External User
 
Posts: 1
Default #40937 : date() and dst update



ID: 40937
Updated by: tony2001@php.net
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-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] derick@php.net

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."=".$cu rdate2."|";

}
?>


------------------------------------------------------------------------

[2007-03-28 15:21:00] ctrlaltca at libero dot it

Description:
------------
It seems that the date() function "jumps over" sundays when converting
timestamps not referring to midnight.
Similar to #461


Reproduce code:
---------------
<?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",$c);

$d=date("r");
$e=strtotime($d. "-" . $i . " day");
$curdate2=date("Ymd",$e);
echo
"\n|".$b."=".$d."|".$c."=".$e."|".$curdate."=".$cu rdate2."|";

}
?>

Expected result:
----------------
I expect this script to return the right "Ymd" dates of the last seven
days.

Actual result:
--------------
It works:
|Wed, 28 Mar 2007 00:00:00 +0200=Wed, 28 Mar 2007 17:13:37
+0200|1175032800=1175094817|20070328!=20070328|
but when it finds a sunday, dates are shifted off of 1 day:
|Wed, 28 Mar 2007 00:00:00 +0200=Wed, 28 Mar 2007 17:13:37
+0200|1174773600=1174835617|20070324!=20070325|

------------------------------------------------------------------------


--
Edit this bug report at http://bugs.php.net/?id=40937&edit=1
  Reply With Quote
3 16th July 11:26
External User
 
Posts: 1
Default #40937 : date() and dst update


ID: 40937
Updated by: derick@php.net
Reported By: ctrlaltca at libero dot it
-Status: Assigned
+Status: Feedback
Bug Type: Date/time related
Operating System: Slackware Linux
PHP Version: 5.2.1
Assigned To: derick
New Comment:

What does the following output:

echo date_default_timezone_get(), "\n";

Previous Comments:
------------------------------------------------------------------------

[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] derick@php.net

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."=".$cu rdate2."|";

}
?>


------------------------------------------------------------------------

[2007-03-28 15:21:00] ctrlaltca at libero dot it

Description:
------------
It seems that the date() function "jumps over" sundays when converting
timestamps not referring to midnight.
Similar to #461


Reproduce code:
---------------
<?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",$c);

$d=date("r");
$e=strtotime($d. "-" . $i . " day");
$curdate2=date("Ymd",$e);
echo
"\n|".$b."=".$d."|".$c."=".$e."|".$curdate."=".$cu rdate2."|";

}
?>

Expected result:
----------------
I expect this script to return the right "Ymd" dates of the last seven
days.

Actual result:
--------------
It works:
|Wed, 28 Mar 2007 00:00:00 +0200=Wed, 28 Mar 2007 17:13:37
+0200|1175032800=1175094817|20070328!=20070328|
but when it finds a sunday, dates are shifted off of 1 day:
|Wed, 28 Mar 2007 00:00:00 +0200=Wed, 28 Mar 2007 17:13:37
+0200|1174773600=1174835617|20070324!=20070325|

------------------------------------------------------------------------


--
Edit this bug report at http://bugs.php.net/?id=40937&edit=1
  Reply With Quote
4 16th July 13:56
php-bugs
External User
 
Posts: 1
Default #40937 : date() and dst update


ID: 40937
User updated by: ctrlaltca at libero dot it
Reported By: ctrlaltca at libero dot it
-Status: Feedback
+Status: Open
Bug Type: Date/time related
Operating System: Slackware Linux
PHP Version: 5.2.1
New Comment:

root@tiamat:~# php -r "echo date_default_timezone_get();"
Europe/Berlin

It's an alias for GMT+1


Previous Comments:
------------------------------------------------------------------------

[2007-04-03 18:52:22] derick@php.net

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] derick@php.net

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."=".$cu rdate2."|";

}
?>


------------------------------------------------------------------------

[2007-03-28 15:21:00] ctrlaltca at libero dot it

Description:
------------
It seems that the date() function "jumps over" sundays when converting
timestamps not referring to midnight.
Similar to #461


Reproduce code:
---------------
<?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",$c);

$d=date("r");
$e=strtotime($d. "-" . $i . " day");
$curdate2=date("Ymd",$e);
echo
"\n|".$b."=".$d."|".$c."=".$e."|".$curdate."=".$cu rdate2."|";

}
?>

Expected result:
----------------
I expect this script to return the right "Ymd" dates of the last seven
days.

Actual result:
--------------
It works:
|Wed, 28 Mar 2007 00:00:00 +0200=Wed, 28 Mar 2007 17:13:37
+0200|1175032800=1175094817|20070328!=20070328|
but when it finds a sunday, dates are shifted off of 1 day:
|Wed, 28 Mar 2007 00:00:00 +0200=Wed, 28 Mar 2007 17:13:37
+0200|1174773600=1174835617|20070324!=20070325|

------------------------------------------------------------------------


--
Edit this bug report at http://bugs.php.net/?id=40937&edit=1
  Reply With Quote
5 17th July 01:31
External User
 
Posts: 1
Default #40937 : date() and dst update


ID: 40937
Updated by: tony2001@php.net
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

root@tiamat:~# php -r "echo date_default_timezone_get();"
Europe/Berlin

It's an alias for GMT+1

------------------------------------------------------------------------

[2007-04-03 18:52:22] derick@php.net

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] derick@php.net

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."=".$cu rdate2."|";

}
?>


------------------------------------------------------------------------

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
  Reply With Quote
6 17th July 10:11
External User
 
Posts: 1
Default #40937 : date() and dst update


ID: 40937
Updated by: derick@php.net
Reported By: ctrlaltca at libero dot it
-Status: Assigned
+Status: Feedback
Bug Type: Date/time related
Operating System: Slackware Linux
PHP Version: 5.2.1
Assigned To: derick
New Comment:

I get the following correct output:
|Sat, 24 Mar 2007 22:00:00 +0100|1174770000|20070324 220000 +0100 CET|
|Sat, 24 Mar 2007 22:00:00 +0100|1174773600|20070324 230000 +0100 CET|
|Sat, 24 Mar 2007 22:00:00 +0100|1174777200|20070325 000000 +0100 CET|
|Sat, 24 Mar 2007 22:00:00 +0100|1174780800|20070325 010000 +0100 CET|
|Sat, 24 Mar 2007 22:00:00 +0100|1174784400|20070325 030000 +0200
CEST|
|Sat, 24 Mar 2007 22:00:00 +0100|1174788000|20070325 040000 +0200
CEST|
|Sat, 24 Mar 2007 22:00:00 +0100|1174791600|20070325 050000 +0200
CEST|
|Sat, 24 Mar 2007 22:00:00 +0100|1174795200|20070325 060000 +0200
CEST|

after modifying your date line to:
$curdate=date("Ymd His O T",$c);

Previous Comments:
------------------------------------------------------------------------

[2007-04-04 09:47:39] ctrlaltca at libero dot it

root@tiamat:~# php -r "echo date_default_timezone_get();"
Europe/Berlin

It's an alias for GMT+1

------------------------------------------------------------------------

[2007-04-03 18:52:22] derick@php.net

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] derick@php.net

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."=".$cu rdate2."|";

}
?>


------------------------------------------------------------------------

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
  Reply With Quote
7 18th July 05:52
php-bugs
External User
 
Posts: 1
Default #40937 : date() and dst update


ID: 40937
User updated by: ctrlaltca at libero dot it
Reported By: ctrlaltca at libero dot it
-Status: Feedback
+Status: Closed
Bug Type: Date/time related
Operating System: Slackware Linux
PHP Version: 5.2.1
New Comment:

I tried this script on other machines and it's working correctly as you
said. Only my work pc was acting bad. Reformatted and reinstalled, now
it's working right. It seems it was something corrupted on my pc. Sorry
for wasting your time..


Previous Comments:
------------------------------------------------------------------------

[2007-04-11 14:06:42] derick@php.net

I get the following correct output:
|Sat, 24 Mar 2007 22:00:00 +0100|1174770000|20070324 220000 +0100 CET|
|Sat, 24 Mar 2007 22:00:00 +0100|1174773600|20070324 230000 +0100 CET|
|Sat, 24 Mar 2007 22:00:00 +0100|1174777200|20070325 000000 +0100 CET|
|Sat, 24 Mar 2007 22:00:00 +0100|1174780800|20070325 010000 +0100 CET|
|Sat, 24 Mar 2007 22:00:00 +0100|1174784400|20070325 030000 +0200
CEST|
|Sat, 24 Mar 2007 22:00:00 +0100|1174788000|20070325 040000 +0200
CEST|
|Sat, 24 Mar 2007 22:00:00 +0100|1174791600|20070325 050000 +0200
CEST|
|Sat, 24 Mar 2007 22:00:00 +0100|1174795200|20070325 060000 +0200
CEST|

after modifying your date line to:
$curdate=date("Ymd His O T",$c);


------------------------------------------------------------------------

[2007-04-04 09:47:39] ctrlaltca at libero dot it

root@tiamat:~# php -r "echo date_default_timezone_get();"
Europe/Berlin

It's an alias for GMT+1

------------------------------------------------------------------------

[2007-04-03 18:52:22] derick@php.net

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.

------------------------------------------------------------------------

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
  Reply With Quote
8 18th July 05:52
External User
 
Posts: 1
Default #40937 : date() and dst update


ID: 40937
Updated by: derick@php.net
Reported By: ctrlaltca at libero dot it
-Status: Closed
+Status: Bogus
Bug Type: Date/time related
Operating System: Slackware Linux
PHP Version: 5.2.1
New Comment:

Okay, good to know. I will mark this bug as "Bogus" as it was not a bug
in PHP.


Previous Comments:
------------------------------------------------------------------------

[2007-04-16 13:36:41] ctrlaltca at libero dot it

I tried this script on other machines and it's working correctly as you
said. Only my work pc was acting bad. Reformatted and reinstalled, now
it's working right. It seems it was something corrupted on my pc. Sorry
for wasting your time..

------------------------------------------------------------------------

[2007-04-11 14:06:42] derick@php.net

I get the following correct output:
|Sat, 24 Mar 2007 22:00:00 +0100|1174770000|20070324 220000 +0100 CET|
|Sat, 24 Mar 2007 22:00:00 +0100|1174773600|20070324 230000 +0100 CET|
|Sat, 24 Mar 2007 22:00:00 +0100|1174777200|20070325 000000 +0100 CET|
|Sat, 24 Mar 2007 22:00:00 +0100|1174780800|20070325 010000 +0100 CET|
|Sat, 24 Mar 2007 22:00:00 +0100|1174784400|20070325 030000 +0200
CEST|
|Sat, 24 Mar 2007 22:00:00 +0100|1174788000|20070325 040000 +0200
CEST|
|Sat, 24 Mar 2007 22:00:00 +0100|1174791600|20070325 050000 +0200
CEST|
|Sat, 24 Mar 2007 22:00:00 +0100|1174795200|20070325 060000 +0200
CEST|

after modifying your date line to:
$curdate=date("Ymd His O T",$c);


------------------------------------------------------------------------

[2007-04-04 09:47:39] ctrlaltca at libero dot it

root@tiamat:~# php -r "echo date_default_timezone_get();"
Europe/Berlin

It's an alias for GMT+1

------------------------------------------------------------------------

[2007-04-03 18:52:22] derick@php.net

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

------------------------------------------------------------------------

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
  Reply With Quote


  sponsored links


Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666