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 // converts Julian calender Date to // Julian Day number. $jdate = juliantojd(8, 30, 2018); // printd the Julian Day Count echo "Julian Day count: " . $jdate . "\n"; // converts Julian Day number to // Julian calender Date. $julian = jdtojulian($jdate); // prints the Julian calender Date. echo "Julian calender: " . $julian; ?> |
Julian Day count: 2458374 Julian calender: 8/30/2018
Program 2:
<?php // convert Julian Calender Date to Julian Day number. $jdate = juliantojd(12, 3, 2001); // prints the Julian calender. echo "Julian calender " . $jdate . "\n"; // convert Julian calender Date into julian Day number. $julian = jdtojulian($jdate); // print the Julian date number. echo "Julian Date Count : " . $julian; ?> |
Julian calender 2452260 Julian Date Count : 12/3/2001
Related Articles:
Reference: http://php.net/manual/en/function.juliantojd.php
Recommended Posts:
- How to get the function name from within that function using JavaScript ?
- D3.js | d3.min() function
- PHP | dir() Function
- PHP Ds\Set sum() Function
- D3.js | d3.set.add() Function
- PHP | ord() Function
- PHP | Ds\Map last() Function
- D3.js | d3.map.get() Function
- PHP | pow( ) Function
- p5.js | hex() function
- PHP | Ds\Set xor() Function
- PHP | Ds\Map map() Function
- PHP Ds\Set get() Function
- PHP | each() Function
- PHP | Ds\Map put() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



