Skip to content

Instantly share code, notes, and snippets.

@abedsujan
Created February 11, 2012 11:49
Show Gist options
  • Save abedsujan/1798944 to your computer and use it in GitHub Desktop.
Save abedsujan/1798944 to your computer and use it in GitHub Desktop.
PHP: Week Days.
// 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