|
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;
}
Navigation:
[Reply to this message]
|