mkrausnick
Programmer
I am new to PHP. The following test script does not seem to produce the correct results on my server. The server is located in the U.S. eastern time zone, if that makes any difference.
The script is:
After accessing the page on Friday, October 24th 2003, the result I see in my browser is:
Test Page today is 20031024
sunday is 20031026
this week sunday is 20031102
next week sunday is 20031109
last week sunday is 20031019
20031024
monday is 20031026
this week monday is 20031103
next week monday is 20031110
last week monday is 20031020
20031024
tuesday is 20031027
this week tuesday is 20031104
next week tuesday is 20031111
last week tuesday is 20031021
wednesday is 20031028
this week wednesday is 20031105
next week wednesday is 20031112
last week wednesday is 20031022
20031024
thursday is 20031029
this week thursday is 20031106
next week thursday is 20031113
last week thursday is 20031023
20031024
friday is 20031024
this week friday is 20031031
next week friday is 20031107
last week friday is 20031017
20031024
saturday is 20031025
this week saturday is 20031101
next week saturday is 20031108
last week saturday is 20031018
Note that all dates from 'sunday' through 'thursday' are off by one day. In fact, as I've been checking this page all week, the result is that the date is off by one day for each day up to the current day, then from the current day forward, the date is correct.
Is this a known issue with PHP, does my hosting service not have the current version of PHP, or what?
Mike Krausnick
Dublin, California
The script is:
Code:
<?php
echo 'today is ';
echo date(Ymd);
echo '<br>sunday is ';
echo date(Ymd,strtotime('sunday'));
echo '<br>this week sunday is ';
echo date(Ymd,strtotime('this week sunday'));
echo '<br>next week sunday is ';
echo date(Ymd,strtotime('next week sunday'));
echo '<br>last week sunday is ';
echo date(Ymd,strtotime('last week sunday'));
echo '<br><br>' ;
echo date(Ymd);
echo '<br>monday is ';
echo date(Ymd,strtotime('monday'));
echo '<br>this week monday is ';
echo date(Ymd,strtotime('this week monday'));
echo '<br>next week monday is ';
echo date(Ymd,strtotime('next week monday'));
echo '<br>last week monday is ';
echo date(Ymd,strtotime('last week monday'));
echo '<br><br>' ;
echo date(Ymd);
echo '<br>tuesday is ';
echo date(Ymd,strtotime('tuesday'));
echo '<br>this week tuesday is ';
echo date(Ymd,strtotime('this week tuesday'));
echo '<br>next week tuesday is ';
echo date(Ymd,strtotime('next week tuesday'));
echo '<br>last week tuesday is ';
echo date(Ymd,strtotime('last week tuesday'));
echo '<br><br>' ;
echo '<br>wednesday is ';
echo date(Ymd,strtotime('wednesday'));
echo '<br>this week wednesday is ';
echo date(Ymd,strtotime('this week wednesday'));
echo '<br>next week wednesday is ';
echo date(Ymd,strtotime('next week wednesday'));
echo '<br>last week wednesday is ';
echo date(Ymd,strtotime('last week wednesday'));
echo '<br><br>' ;
echo date(Ymd);
echo '<br>thursday is ';
echo date(Ymd,strtotime('thursday'));
echo '<br>this week thursday is ';
echo date(Ymd,strtotime('this week thursday'));
echo '<br>next week thursday is ';
echo date(Ymd,strtotime('next week thursday'));
echo '<br>last week thursday is ';
echo date(Ymd,strtotime('last week thursday'));
echo '<br><br>' ;
echo date(Ymd);
echo '<br>friday is ';
echo date(Ymd,strtotime('friday'));
echo '<br>this week friday is ';
echo date(Ymd,strtotime('this week friday'));
echo '<br>next week friday is ';
echo date(Ymd,strtotime('next week friday'));
echo '<br>last week friday is ';
echo date(Ymd,strtotime('last week friday'));
echo '<br><br>' ;
echo date(Ymd);
echo '<br>saturday is ';
echo date(Ymd,strtotime('saturday'));
echo '<br>this week saturday is ';
echo date(Ymd,strtotime('this week saturday'));
echo '<br>next week saturday is ';
echo date(Ymd,strtotime('next week saturday'));
echo '<br>last week saturday is ';
echo date(Ymd,strtotime('last week saturday'));
?>
After accessing the page on Friday, October 24th 2003, the result I see in my browser is:
Test Page today is 20031024
sunday is 20031026
this week sunday is 20031102
next week sunday is 20031109
last week sunday is 20031019
20031024
monday is 20031026
this week monday is 20031103
next week monday is 20031110
last week monday is 20031020
20031024
tuesday is 20031027
this week tuesday is 20031104
next week tuesday is 20031111
last week tuesday is 20031021
wednesday is 20031028
this week wednesday is 20031105
next week wednesday is 20031112
last week wednesday is 20031022
20031024
thursday is 20031029
this week thursday is 20031106
next week thursday is 20031113
last week thursday is 20031023
20031024
friday is 20031024
this week friday is 20031031
next week friday is 20031107
last week friday is 20031017
20031024
saturday is 20031025
this week saturday is 20031101
next week saturday is 20031108
last week saturday is 20031018
Note that all dates from 'sunday' through 'thursday' are off by one day. In fact, as I've been checking this page all week, the result is that the date is off by one day for each day up to the current day, then from the current day forward, the date is correct.
Is this a known issue with PHP, does my hosting service not have the current version of PHP, or what?
Mike Krausnick
Dublin, California