You are here

function date_calc_date_diff in Date 6.2

Same name and namespace in other branches
  1. 5.2 date_php4/date_php4_calc.inc \date_calc_date_diff()
  2. 6 date_php4/date_php4_calc.inc \date_calc_date_diff()

Returns number of days between two given dates

Parameters

int $day1: the day of the month

int $month1: the month

int $year1: The 4 digit year. Do not add leading 0's for years prior to 1000.

int $day2: the day of the month

int $month2: the month

int $year2: The 4 digit year. Do not add leading 0's for years prior to 1000.

Return value

int the absolute number of days between the two dates. If an error occurs, -1 is returned.

File

date_php4/date_php4_calc.inc, line 1460

Code

function date_calc_date_diff($day1, $month1, $year1, $day2, $month2, $year2) {
  if (!date_calc_is_valid($day1, $month1, $year1)) {
    return -1;
  }
  if (!date_calc_is_valid($day2, $month2, $year2)) {
    return -1;
  }
  return abs(date_calc_date_to_days($day1, $month1, $year1) - date_calc_date_to_days($day2, $month2, $year2));
}