|
Posted by Steve on 11/09/07 03:10
"Steve" <no.one@example.com> wrote in message
news:9SJYi.81$e61.27@newsfe06.lga...
>
> "Reg143" <Reg143@aol.com> wrote in message
> news:Xns99E28F9944564Reg143aolcom@199.45.49.11...
>> Hi all,
>>
>> The code below loops from a starting date, incrementing the date and
>> displaying date and day-of-week. Everything is fine until 2007-11-04 is
>> reached. Any help would be appreciated.
>>
>> Thanks in advance.
>>
>> ----------------------------------------------------
>> Dates.php
>> ----------------------------------------------------
>>
>> <?php
>>
>> // ----------------------------------
>> // This code works until the date hits 2007-11-04, it
>> // never gets past 11/4. Run it starting with the
>> // different dates below. What gives?
>> // ------------------------------------
sorry, saw an obvious mistake...this fixes it:
$date = strtotime('2007-11-04');
$dates = array();
for ($i = 0; $i < 7; $i++)
{
$dates[] = getdate(strtotime('+' . $i . ' day', $date));
}
foreach ($dates as $date)
{
$date[0] = date('Y-m-d', $date[0]);
echo '<pre>' .
$date[0] .
' is on a ' .
$date['weekday'] .
'</pre>';
}
Navigation:
[Reply to this message]
|