PHP | jdtogregorian() Function
Last Updated :
27 Apr, 2018
The jdtogregorian() function is a built-in function which converts a Julian Day Integer to Gregorian date. The function accepts a Julian Day integer and returns the converted Gregorian Date in $month / $day / $year.
Syntax:
jdtogregorian($jd)
Parameters: The function accepts one mandatory parameter $jd which specifies the Julian day.
Return Value: The function returns the Gregorian date. The return format of the date is $month / $day / $year.
Examples:
Input : 2458209
Output : 3/31/2018
Input : 2458236
Output : 4/27/2018
Below programs illustrate the jdtogregorian() function.
Program 1: The program below illustrate the use of jdtogregorian() function.
<?php
$jd = gregoriantojd(3, 31, 2018);
$date = jdtogregorian( $jd );
echo ( $date ), "\n" ;
?>
|
Output:
3/31/2018
Program 2: The program below shows the output when an invalid Julian day integer is passed.
<?php
$date = jdtogregorian(0);
echo ( $date ), "\n" ;
?>
|
Output:
0/0/0
Reference:
http://php.net/manual/en/function.jdtogregorian.php
Share your thoughts in the comments
Please Login to comment...