Created
July 13, 2012 09:12
-
-
Save tbsmcd/3103807 to your computer and use it in GitHub Desktop.
13fri3
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
$period = new DatePeriod( | |
new Datetime('2012-01-13'), | |
new DateInterval('P1M'), | |
new Datetime('2012-12-13') | |
); | |
foreach ($period as $day) { | |
echo $day->format('Y-m-d') . PHP_EOL; | |
} | |
// 2012-01-13 | |
// 2012-02-13 | |
// 2012-03-13 | |
// 2012-04-13 | |
// 2012-05-13 | |
// 2012-06-13 | |
// 2012-07-13 | |
// 2012-08-13 | |
// 2012-09-13 | |
// 2012-10-13 | |
// 2012-11-13 | |
$period = new DatePeriod( | |
new Datetime('2012-01-13'), | |
new DateInterval('P1M'), | |
new Datetime('2012-12-13 00:00:01') | |
); | |
foreach ($period as $day) { | |
echo $day->format('Y-m-d') . PHP_EOL; | |
} | |
// 2012-01-13 | |
// 2012-02-13 | |
// 2012-03-13 | |
// 2012-04-13 | |
// 2012-05-13 | |
// 2012-06-13 | |
// 2012-07-13 | |
// 2012-08-13 | |
// 2012-09-13 | |
// 2012-10-13 | |
// 2012-11-13 | |
// 2012-12-13 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment