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

Sr.No Parameter & Description
1

month(Required)

The month as a number from 1 (for January) to 12 (for December)

2

day(Required)

The day as a number from 1 to 31

3

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(1, 12, 1990);
   echo "$jd";
   print "\n";
   
   $gregorian = jdtogregorian($jd);
   echo "$gregorian";
   print "\n";
?> 

This will produce the following result −

2447904 
1/12/1990

php_function_reference.htm

Advertisements