PHP Function Reference

PHP jdtojulian() Function



The PHP jdtojulian() function converts a Julian Day Count to the Julian Calendar Date. The function takes a Julian Day integer and returns the converted Julian Calendar Date as a string in the form "month/day/year".

Syntax

jdtojulian(julian_day)

Parameters

julian_day Required. Specify a Julian day number as integer.

Return Value

Returns the Julian Calendar Date as a string in the form "month/day/year".

Exceptions

NA.

Example:

The example below shows the usage of jdtojulian() function.

<?php
//converting a Julian Calendar Date
//to Julian integer 
$jd = juliantojd(10, 2, 2015);
  
//displaying the Julian day integer 
echo "The Julian day integer is: $jd \n";
  
//converting the Julian day integer 
//to Julian Calendar Date
$date = jdtojulian($jd);
  
//displaying the Julian Calendar Date
echo "The Julian Calendar Date is: $date \n"; 
?>

The output of the above code will be:

The Julian day integer is: 2457311 
The Julian Calendar Date is: 10/2/2015 

Example: Overflow behavior

Consider one more example to see the overflow behavior of this function.

<?php
//converting an invalid Julian Calendar 
//date to Julian integer 
$jd = juliantojd(15, 2, 2018);
  
//prints 0 as month is out of range 
echo "The Julian day integer is: $jd \n";
  
//converting the Julian day integer 
//to Julian Calendar Date
$date = jdtojulian($jd);
  
//prints 0/0/0 as Julian Calendar 
//month is out of range
echo "The Julian Calendar Date is: $date \n"; 
?>

The output of the above code will be:

The Julian day integer is: 0 
The Julian Calendar Date is: 0/0/0 

❮ PHP Calendar Reference