PHP gregoriantojd() Function

Definition

The gregoriantojd() function converts a date from the Gregorian Calendar to a Julian Day Count.

Syntax

PHP gregoriantojd() Function has the following syntax.

gregoriantojd(month,day,year);

Parameter

ParameterIs RequiredDescription
monthRequired.Month as a number from 1 to 12
dayRequired.Day as a number from 1 to 31
yearRequired.Year as a number between -4714 and 9999

Return

PHP gregoriantojd() Function returns a Julian Day number.

Example

Convert a Gregorian date to a Julian Day Count and back to a Gregorian date:


<?php/*  w ww  . j  av a  2s.c om*/
$jd=gregoriantojd(6,20,2013);
echo $jd . "\n";
echo jdtogregorian($jd);
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    Function reference »




PHP Array Functions
PHP Calendar Functions
PHP Class Functions
PHP Data Type Functions
PHP Date Functions
PHP File Functions
PHP Image Functions
PHP Math Functions
PHP MySQLi Functions
PHP SimpleXML Functions
PHP String Functions
PHP XML Functions
PHP Zip Functions