Skip to content

Instantly share code, notes, and snippets.

View krisidmisso's full-sized avatar

Krisid Misso krisidmisso

View GitHub Profile
@krisidmisso
krisidmisso / calc_working_days.php
Created March 20, 2018 16:04
Calculate working days without saturday, sunday and holidays
// based on https://gist.github.com/themattharris/1143040
function calc_working_days($from, $to, $normalise = true)
{
$_from = is_int($from) ? $from : strtotime($from);
$_to = is_int($to) ? $to : strtotime($to);
// normalising means partial days are counted as a complete day.
if ($normalise) {
$_from = strtotime(date('Y-m-d', $_from));
$_to = strtotime(date('Y-m-d', $_to));