Reply to Re: generating a list of dates

Your name:

Reply:


Posted by Curtis on 01/30/07 02:46

On Jan 28, 9:39 pm, "laredotorn...@zipmail.com"
<laredotorn...@zipmail.com> wrote:
> Hi,
>
> Using PHP 4.4.4, I want to generate an array that contains strings
> representing days from Jan. 1, 2005 to whatever the current day is.
> So the array would contain the first values
>
> '2005-01-01', '2005-01-02', '2005-01-03'
>
> and end with the values
>
> '2007-01-27', '2007-01-28'
>
> In case you're interested, I will then take this array and populate a
> MySQL table.
>
> Thanks for any advice, - Dave

I thought I'd see if I could figure it out my own version. This seems
to work:

function daysUntilNow($month, $day, $year, $format = 'Y-m-d') {
$d = array();
$ts = 0;

while ( ($ts = mktime(0,0,0,$month,$day,$year)) < time() ){
$ts = mktime(0,0,0,$month,$day,$year);
$d[] = date($format,$ts);
$day++; // increment days
}
return $d;
}

[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

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