PHP code example of maxmeffert / feiertage
1. Go to this page and download the library: Download maxmeffert/feiertage library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
maxmeffert / feiertage example snippets
$ft = Feiertage::of(2020);
$ft = Feiertage::of(2020);
$os = $ft[FeiertagEnum::OSTERSONNTAG];
$date = new \DateTime(...);
if (Feiertage::check($date))
{
...
}
$date = new \DateTime(...);
$which = Feiertage::which($date);
if ($which == FeiertagEnum::OSTERSONNTAG)
{
...
}
foreach (Feiertage::of(2020) as $holiday)
{
...
}
function div (int $a, int $b) : int {
return intval( $a / $b );
}
function mod (int $a, int $b) : int {
return intval( $a % $b );
}
function gauss (int $year) : int {
$a = mod($year, 19);
$b = mod($year, 4);
$c = mod($year, 7);
$H1 = div($year, 100);
$H2 = div($year, 400);
$N = 4 + $H1 - $H2;
$M = 15 + $H1 - $H2 - div(8 * $H1 + 13, 25);
$d = mod(19 * $a + $M, 30);
$e = mod(2 * $b + 4 * $c + 6 * $d + $N, 7);
$o = 22 + $d + $e;
if ($o == 57) {
$o = 50;
}
if ($d == 28 && $e == 6 && $a > 10) {
$o = 49;
}
return $o;
}
function easterSunday (int $year) : \DateTimeImmutable {
$day = gauss($year);
$month = 3;
if (31 < $os) {
$day = mod($os, 31);
$month = 4;
}
return new \DateTimeImmutable("{$year}-{$month}-{$day}");
}
easter_date
easter_date
easter_date
easter_date