1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| function idiv($dividend, $divisor) {
return [intdiv($dividend, $divisor), $dividend % $divisor];
}
function butcherMeeus($year) {
$n = $year % 19;
[$c, $u] = idiv($year, 100);
[$s, $t] = idiv($c, 4);
$p = intdiv($c + 8, 25);
$q = intdiv($c - $p + 1, 3);
$e = ( 19*$n + $c - $s - $q + 15 ) % 30;
[$b, $d] = idiv($u, 4);
$L = ( 2*$t + 2*$b - $e - $d + 32 ) % 7;
$h = intdiv($n + 11*$e + 22*$L, 451);
[$m, $j] = idiv($e + $L - 7*$h + 115, 31);
return new DateTimeImmutable("$year-$m-$j");
} |
Partager