1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
function dateLundi($annee,$semaine) {
$i=0;
do {
$ladate = mktime(0,0,0,1,($semaine+$i)*7,$annee);
if (date('W',$ladate) == $semaine) {
if (date('w',$ladate) == 0) {
$lundi = mktime(0,0,0,date('n',$ladate),date('j',$ladate)-6,$annee);
}
else {
$lundi = mktime(0,0,0,date('n',$ladate),date('j',$ladate)+1-date('w',$ladate),$annee);
}
break;
}
elseif (date('W',$ladate) > $semaine) $i--;
else $i++;
}while(abs($i)>3);
return $lundi;
}
echo date('d/m/Y',dateLundi(2007,14) ); |
Partager