Skip to content

Instantly share code, notes, and snippets.

@emulsion-io
Created November 22, 2013 19:37
Show Gist options
  • Save emulsion-io/7605579 to your computer and use it in GitHub Desktop.
Save emulsion-io/7605579 to your computer and use it in GitHub Desktop.
Liste toutes les dates ( debut et fin ) en fonction de leur numero de semaine ( attention si la semaine 1 ne commence pas un lundi )
<?php
for ($w=1; $w < 53; $w++) {
for($i = 1; $i <= 365; $i++) {
$week = date("W", mktime(0, 0, 0, 1, $i, 2014));
if($week == $w) {
$debut = date("Y-m-d", mktime(0, 0, 0, 1, $i, 2014));
$fin = date("Y-m-d", mktime(0, 0, 0, 1, $i+6, 2014));
echo '<a href="/api/index.php?date_du='.$debut.'&amp;date_au='.$fin.'" target="_blank">Semaine '.$w.'</a><br />';
break;
}
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment