function date_calc_date_to_days in Date 6
Same name and namespace in other branches
- 5.2 date_php4/date_php4_calc.inc \date_calc_date_to_days()
- 6.2 date_php4/date_php4_calc.inc \date_calc_date_to_days()
Converts a date to number of days since a distant unspecified epoch
Parameters
int $day: The day of the month.
int $month: The month.
int $year: The 4 digit year. Do not add leading 0's for years prior to 1000.
Return value
integer The number of days since the date_calc epoch.
14 calls to date_calc_date_to_days()
- date_calc_begin_of_next_week in date_php4/
date_php4_calc.inc - Find the month day of the beginning of week after given date, using variable_get('date_first_day', 1). Can return weekday of next month.
- date_calc_begin_of_prev_week in date_php4/
date_php4_calc.inc - Find the month day of the beginning of week before given date, using variable_get('date_first_day', 1). Can return weekday of prev month.
- date_calc_begin_of_week in date_php4/
date_php4_calc.inc - Find the month day of the beginning of week for given date, using variable_get('date_first_day', 1). Can return weekday of prev month.
- date_calc_compare_dates in date_php4/
date_php4_calc.inc - Compares two dates
- date_calc_date_diff in date_php4/
date_php4_calc.inc - Returns number of days between two given dates
File
- date_php4/
date_php4_calc.inc, line 199
Code
function date_calc_date_to_days($day, $month, $year) {
$century = (int) substr($year, 0, 2);
$year = (int) substr($year, 2, 2);
if ($month > 2) {
$month -= 3;
}
else {
$month += 9;
if ($year) {
$year--;
}
else {
$year = 99;
$century--;
}
}
return floor(146097 * $century / 4) + floor(1461 * $year / 4) + floor((153 * $month + 2) / 5) + $day + 1721119;
}