You are here

function date_calc_julian_date in Date 6.2

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

Returns number of days since 31 December of year before given date.

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

int The julian date for the date.

2 calls to date_calc_julian_date()
date_calc_format in date_php4/date_php4_calc.inc
Formats the date in the given format, much like strfmt()
date_php4.inc in date_php4/date_php4.inc

File

date_php4/date_php4_calc.inc, line 461

Code

function date_calc_julian_date($day = 0, $month = 0, $year = 0) {
  if (empty($year)) {
    $year = date_calc_get_year();
  }
  if (empty($month)) {
    $month = date_calc_get_month();
  }
  if (empty($day)) {
    $day = date_calc_get_day();
  }
  $days = array(
    0,
    31,
    59,
    90,
    120,
    151,
    181,
    212,
    243,
    273,
    304,
    334,
  );
  $julian = $days[$month - 1] + $day;
  if ($month > 2 && date_is_leap_year($year)) {
    $julian++;
  }
  return $julian;
}