Last active
August 29, 2015 14:04
-
-
Save codenuke/1e58eb2f0e355a85afc6 to your computer and use it in GitHub Desktop.
Find day of week in date range.
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 | |
$start_date = new DateTime('2014-07-01'); // Create Start Date | |
$end_date = new DateTime('2014-07-31'); // Create End Date | |
$interval = DateInterval::createFromDateString('1 day'); | |
$period = new DatePeriod($start_date , $interval, $end_date); | |
$day_of_week = array(); | |
foreach ($period as $dt) | |
{ | |
$day_of_week[] = $dt->format("N"); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment