Created
February 2, 2017 10:57
-
-
Save oboshto/24aa563fdef8a54e97bf61377b8f53cb to your computer and use it in GitHub Desktop.
Just an example to include the end date using the DateTime method 'modify'
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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>"; | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment