PHP | juliantojd() Function
The juliantojd() function is an inbuilt function in PHP which is used to convert Julian calendar Date to Julian Day count. The range of date for Julian Calendar is valid from Julian Calendar 4713 B.C.(Before Christ) to 9999 A.D.(anno domini).
Syntax:
int juliantojd( $month, $day, $year )
Parameters: This function accepts three parameters as mentioned above and described below:
- $month: It is a mandatory parameter which is used to specify the month number in Julian Calendar. The month number is in range 1 (i.e January) to 12 (i.e December).
- $day: It is a mandatory parameter which is used to specify the day in Julian calendar. The day number is in range 1 to 31.
- $year: It is a mandatory parameter which is used to specify the year in Julian calendar. The year number is from -4713 to 9999.
Return Value: This function returns a Julian Day for the given Julian date.
Exceptions: The Valid range of the Julian calendar is 4713 B.C. to 9999 A.D.
Below programs illustrate the juliantojd() function in PHP.
Program 1:
PHP
<?php
$jdate = juliantojd(8, 30, 2018);
echo "Julian Day count: " . $jdate . "\n" ;
$julian = jdtojulian( $jdate );
echo "Julian calendar: " . $julian ;
?>
|
Output
Julian Day count: 2458374
Julian calendar: 8/30/2018
Program 2:
PHP
<?php
$jdate = juliantojd(12, 3, 2001);
echo "Julian calendar " . $jdate . "\n" ;
$julian = jdtojulian( $jdate );
echo "Julian Date Count : " . $julian ;
?>
|
Output
Julian calendar 2452260
Julian Date Count : 12/3/2001
Related Articles:
Reference: http://php.net/manual/en/function.juliantojd.php
Last Updated :
05 Jan, 2023
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...