Created
October 19, 2013 23:08
-
-
Save leevigraham/7062681 to your computer and use it in GitHub Desktop.
Print out the last day of the month with an interval optionally showing the end date.
This file contains 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 | |
$includeEndTime = true; | |
$interval = \DateInterval::createFromDateString('last day of next month'); | |
$start = new \DateTime("last day of January 2000"); | |
$end = new \DateTime("last day of December 2001"); | |
if(true === $includeEndTime) { | |
$end->add($interval); | |
} | |
$datePeriod = new \DatePeriod($start, $interval, $end); | |
foreach($datePeriod as $date) { | |
var_dump($date); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment