1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
| <?php
function listJourFeries($year, $month) {
$res = array();
switch ($month) {
case 1:
$res[] = 1;
break;
case 5:
$res[] = 1;
$res[] = 8;
case 7:
$res[] = 14;
break;
case 8:
$res[] = 15;
break;
case 11:
$res[] = 1;
$res[] = 11;
break;
case 12:
$res[] = 25;
break;
}
// Déclaration de la fonction easter_date() si php ne la connaît pas
if (!function_exists('easter_date')) {
function easter_date($year) {
/*
G is the Golden Number-1
H is 23-Epact (modulo 30)
I is the number of days from 21 March to the Paschal full moon
J is the weekday for the Paschal full moon (0=Sunday,
1=Monday, etc.)
L is the number of days from 21 March to the Sunday on or before
the Paschal full moon (a number between -6 and 28)
*/
$G = $year % 19;
$C = (int) ($year / 100);
$H = (int) ($C - (int) ($C / 4) - (int) ((8 * $C + 13) / 25) + 19 * $G +
15) % 30;
$I = (int) $H - (int) ($H / 28) * (1 - (int) ($H / 28) * (int) (29 /
($H +
1)) * ((int) (21 - $G) / 11));
$J = ($year + (int) ($year / 4) + $I + 2 - $C + (int) ($C / 4)) % 7;
$L = $I - $J;
$m = 3 + (int) (($L + 40) / 44);
$d = $L + 28 - 31 * ((int) ($m / 4));
$y = $year;
$E = mktime(0, 0, 0, $m, $d, $y);
return $E;
}
}
//Calcul pour les dates variables
$secJours = 60 * 60 * 24;
$paques = easter_date($year) + 1 * $secJours;
if (date('m', $paques) == $month) {
$res[] = date('d', $paques);
}
$ascencion = easter_date($year) + 39 * $secJours;
if (date('m', $ascencion) == $month) {
$res[] = date('d', $ascencion);
}
$pentecote = easter_date($year) + 50 * $secJours;
if (date('m', $pentecote) == $month) {
$res[] = date('d', $pentecote);
}
// Retour du tableau des jours fériés pour l'année et le mois demandé
return $res;
} |
Partager