Skip to content

Instantly share code, notes, and snippets.

@spin0us spin0us/gist:5583418
Created May 15, 2013

Embed
What would you like to do?
Check if date (english datetime or unix timestamp) is a french holiday
if(!function_exists('isFrenchHoliday'))
{
function isFrenchHoliday($str)
{
$ts = (preg_match('/^[0-9]{10}$/', $str)) ? $str : strtotime($str);
$date = date("md", $ts);
if($date == '0101') return true; // 1er janvier
if($date == '0501') return true; // 1er mai
if($date == '0508') return true; // 8 mai
if($date == '0714') return true; // 14 juillet
if($date == '0815') return true; // 15 aout
if($date == '1101') return true; // 1er novembre
if($date == '1111') return true; // 11 novembre
if($date == '1225') return true; // 25 decembre
// Fetes religieuses
$easter = easter_date(date("Y",$ts));
if($date == date("md", $easter)) return true; // Paques
if($date == date("md", $easter + 39 * 86400)) return true; // Ascension (paques + 39 jours)
if($date == date("md", $easter + 50 * 86400)) return true; // Pentecote (paques + 50 jours)
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.