This question already has an answer here:
- How to list all months between two dates 4 answers
How do I retrieve all the months on 2015-October to 2016-May date range with PHP? ex - 2015-November, 2015-December, 2016-January.. so on
</div>
This question already has an answer here:
How do I retrieve all the months on 2015-October to 2016-May date range with PHP? ex - 2015-November, 2015-December, 2016-January.. so on
</div>
There is greate example in the PHP docs. http://php.net/manual/en/class.dateperiod.php
<?php
$begin = new DateTime( '2012-08-01' );
$end = new DateTime( '2012-08-31' );
$end = $end->modify( '+1 day' );
$interval = new DateInterval('P1D');
$daterange = new DatePeriod($begin, $interval ,$end);
foreach($daterange as $date){
echo $date->format("Ymd") . "<br>";
}
?>
Just provide the needed date format and you are done.
Change it here:
$date->format("Ymd")
As @Uchiha said there is an answer here: https://stackoverflow.com/a/18743012/2160958