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.


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:

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


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

Program 2:

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


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

Related Articles:

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

This article is attributed to GeeksforGeeks.org

You Might Also Like

leave a comment



load comments

Subscribe to Our Newsletter