PHP | jdtojulian() Function

The jdtojulian() function is an inbuilt function in PHP which is used to convert a Julian day count to a Julian calendar Date. It converts Julian Day Count to a string containing the Julian Calendar Date in the month/day/year format.

Syntax:

int jdtojulian( $julianday )

Parameters: This function accepts single parameter $julianday which is mandatory. It contains julian day as integer.



Return Value: This function returns the Julian Date as a string in the month/day/year format.

Below programs illustrate the jdtojulian() function in PHP.
Program 1:

filter_none

edit
close

play_arrow

link
brightness_4
code

<?php
  
// Converts a Julian calender date 
// to Julian Day count.
$jdate = juliantojd(10, 25, 1996);
  
// Print the Julian Day count.
echo "JulianToJD is : ".$jdate . "\n";
  
// First converts the julian day to Julian 
// Calender date and then print it.
echo "JDToJulian is : ".jdtojulian($jdate);
  
?>

chevron_right


Output:

JulianToJD is : 2450395
JDToJulian is : 10/25/1996

Program 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

<?php
  
// Converts Julian calender Date 
// to Julian Day count.
$jdate = juliantojd(1, 10, 1998);
  
// Print the Julian Day count
echo "Julian Day Count : ".$jdate . "\n";
      
// Converts Julian Day count to
// the Julian calender Date
$julian = jdtojulian($jdate);
  
// Print the julian calender Date.
echo "Julian Calender Date : ".$julian;
  
?> 

chevron_right


Output:

Julian Day Count : 2450837
Julian Calender Date : 1/10/1998

Related Articles:

Reference: http://php.net/manual/en/function.jdtojulian.php



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

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.