Reply to Re: Strange date increment problem

Your name:

Reply:


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>';
}

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация