PHP - Function gregoriantojd()


Advertisements


Syntax

gregoriantojd ( $month, $day, $year );

Definition and Usage

This function Converts a Gregorian date to Julian Day Count. Valid Range for Gregorian Calendar 4714 B.C. to 9999 A.D.

Parameters

Parameter Description
month Required. The month as a number from 1 (for January) to 12 (for December)
day Required. The day as a number from 1 to 31
year Required. The year as a number between -4714 and 9999

Return Value

The julian day for the given gregorian date as an integer.

Example

Try out following example −

<?php
   $jd = gregoriantojd(10, 11, 1970);
   echo "$jd";
   print "\n";
   
   $gregorian = jdtogregorian($jd);
   echo "$gregorian";
   print "\n";
?> 

This will produce the following result −

2440871
10/11/1970

php_function_reference.htm