I am trying to loop through dates with PHP. Currently my code gets stuck in a loop repeating 110307. I need the date format to be in yymmdd. Here is what I was trying to use:
Here's how I prefer to do it:
$startDate = new DateTime('20100227');
$endDate = new DateTime('20100324');
while ($startDate <= $endDate) {
// your code here
...
// go to the next day
$startDate->add(new DateInterval('P1D'));
}
I find this much cleaner personally, and it's nice not having to hard-code values like 84600.