Created
June 30, 2016 19:16
-
-
Save iron-viper/a0452465a955aa6a81c336d4999a9271 to your computer and use it in GitHub Desktop.
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
$dateNow = "04/28/2016"; | |
$timestamp = strtotime($dateNow); | |
$currDayOfWeek = date("w", $timestamp); | |
$startDayOflastWeekT = strtotime(-($currDayOfWeek + 7) . " days", $timestamp); | |
$startDayOflastWeek = date("m/d/Y", $startDayOflastWeekT); | |
$endDayOflastWeekT = strtotime("+ 6 days", $startDayOflastWeekT); | |
$endDayOflastWeek = date("m/d/Y", $endDayOflastWeekT); | |
$startDayOfMiddleWeekT = strtotime("+ 7 days", $startDayOflastWeekT); | |
$startDayOfMiddleWeek = date("m/d/Y", $startDayOfMiddleWeekT); | |
$endDayOfMiddleWeekT = strtotime("+ 13 days", $startDayOflastWeekT); | |
$endDayOfMiddleWeek = date("m/d/Y", $endDayOfMiddleWeekT); | |
$startDayOfNextWeekT = strtotime("+ 14 days", $startDayOflastWeekT); | |
$startDayOfNextWeek = date("m/d/Y", $startDayOfNextWeekT); | |
$endlastDayOfNextWeekT = strtotime("+ 21 days", $startDayOflastWeekT); | |
$endlastDayOfNextWeek = date("m/d/Y", $endlastDayOfNextWeekT); | |
echo $startDayOflastWeek . " - " . $endDayOflastWeek . "\r\n"; | |
echo $startDayOfMiddleWeek . " - " . $endDayOfMiddleWeek . "\r\n"; | |
echo $startDayOfNextWeek . " - " . $endlastDayOfNextWeek . "\r\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment