problem with date returning wrong day although the timestamp is correct!
Posted
by Spiros
on Stack Overflow
See other posts from Stack Overflow
or by Spiros
Published on 2010-04-10T12:20:34Z
Indexed on
2010/04/10
12:23 UTC
Read the original article
Hit count: 277
php
I have a bizzare problem with php date function.
code:
$numDays = 8;
$date = strtotime('2010-11-06');
for ($i=1; $i<=$numDays; $i++)
{
$thisDay = date("D, d M Y", $date);
print ($thisDay.'<br>');
$date+=86400; // add one day to timestamp
}
result on my server (local host, windows):
Sat, 06 Nov 2010
Sun, 07 Nov 2010
Mon, 08 Nov 2010
Tue, 09 Nov 2010
Wed, 10 Nov 2010
Thu, 11 Nov 2010
Fri, 12 Nov 2010
Sat, 13 Nov 2010
Result on my web server (linux)
Sat, 06 Nov 2010
*Sun, 07 Nov 2010
Sun, 07 Nov 2010*
Mon, 08 Nov 2010
Tue, 09 Nov 2010
Wed, 10 Nov 2010
Thu, 11 Nov 2010
Fri, 12 Nov 2010
Notice how Sun, 07 Nov 2010 appears twice on the remote server?? Why is this happening? can anyone explain this Behavior?
© Stack Overflow or respective owner