How can I make an array of existing dates? I need an array with dates from September to May, preferably seven days a week. For 2011-2012

  • And more you can? What do you want to implement? What kind of dates in the array should be? - DemoS

1 answer 1

$start = strtotime('09/01/2010'); $finish = strtotime('05/31/2011'); $arrayOfDates = array(); for($i=$start; $i<$finish; $i+=86400){ list($year,$month,$day) = explode("|",date("Y|m|d",$i)); $arrayOfDates[$year][$month][] = $day; } print_r($arrayOfDates); 

PS date can indicate the day of the week.

 if(date('D',$i)!='Sun' && date('D',$i)!='Sat'); 

Such a condition in the cycle excludes weekends.

  • It is possible and in the range - knes
  • knes, and how can this be done in a range of weeks? - trane294
  • bring a small piece of the desired array, I'll tell you how to implement it - knes
  • Is it possible or agent or icq or skype? But in general, I will have a page where 6 days from September will be displayed. - trane294
  • If this is a calendar, an array of all dates is absolutely not needed. It is worth using what I wrote, but limit the range to a month or three. - knes