示例#1
0
function compare_gap($first_date, $second_date)
{
    // finds gap between 2 years. No need for months or days, since we look for gaps of several years
    include_once CMS_ROOTPATH . 'include/calculate_age_cls.php';
    $process_date = new calculate_year_cls();
    // take care of combined julian/gregorian dates (1678/9)
    if (strpos($first_date, '/') > 0) {
        $temp = explode('/', $first_date);
        $first_date = $temp[0];
    }
    if (strpos($second_date, '/') > 0) {
        $temp = explode('/', $second_date);
        $second_date = $temp[0];
    }
    $year1 = $process_date->search_year($first_date);
    $year2 = $process_date->search_year($second_date);
    if ($year1 and $year2) {
        return $year2 - $year1;
    } else {
        return false;
    }
}