/** * * @param string $start_datetime * @param string $end_datetime * @param string $datetime_to_check * @return bool Indicates wether the time to check is between the two given times */ public static function datetime_is_in_interval($start_datetime, $end_datetime, $datetime_to_check = null, $locale = 'sql') { if (!isset($datetime_to_check)) { $datetime_to_check = DateTool::get_current_datetime($locale); } $start_datetime = DateTool::get_complete_datetime($start_datetime); $end_datetime = DateTool::get_complete_datetime($end_datetime); $datetime_to_check = DateTool::get_complete_datetime($datetime_to_check); $comparison1 = DateTool::compare_dates($start_datetime, $datetime_to_check, $locale); $comparison2 = DateTool::compare_dates($datetime_to_check, $end_datetime, $locale); if (($comparison1 == '<' || $comparison1 == '=') && $comparison2 == '<') { return true; } else { return false; } }