Created
July 27, 2013 09:25
-
-
Save homleen/6094374 to your computer and use it in GitHub Desktop.
获取当前月的所有日期
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
$start = new \DateTime('first day of this month'); | |
$end = new \DateTime('first day of this month + 1 month'); | |
$period = new \DatePeriod($start, new \DateInterval('P1D'), $end); | |
foreach($period as $day){ | |
// here check if you have records with this date and print them, | |
// otherwise print default values | |
print $day->format('d.m.Y') . "\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment