Created
February 11, 2012 11:49
-
-
Save abedsujan/1798944 to your computer and use it in GitHub Desktop.
PHP: Week Days.
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
// set current date | |
$date = '04/30/2009'; | |
// parse about any English textual datetime description into a Unix timestamp | |
$ts = strtotime($date); | |
// find the year (ISO-8601 year number) and the current week | |
$year = date('o', $ts); | |
$week = date('W', $ts); | |
// print week for the current date | |
for($i = 1; $i <= 7; $i++) { | |
// timestamp from ISO week date format | |
$ts = strtotime($year.'W'.$week.$i); | |
print date("m/d/Y l", $ts) . "\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment