PHP Function Reference

PHP jewishtojd() Function



The PHP jewishtojd() function converts a date in the Jewish Calendar to Julian Day Count.

Although this function can handle dates all the way back to the year 1 (3761 B.C.), such use may not be meaningful. The Jewish calendar has been in use for several thousand years, but in the early days there was no formula to determine the start of a month. A new month was started when the new moon was first observed.

Syntax

jewishtojd(month, day, year)

Parameters

month Required. Specify month as a number from 1 to 13, where 1 means Tishri, 13 means Elul, and 6 and 7 mean Adar in regular years, but Adar I and Adar II, respectively, in leap years.
day Required. Specify the day as a number from 1 to 30. If the month has only 29 days, the first day of the following month is assumed.
year Required. Specify year as a number between 1 and 9999.

Return Value

Returns the Julian Day count for the given date in the Jewish Calendar. Dates outside the valid range return 0.

Exceptions

NA.

Example:

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

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

The output of the above code will be:

The Julian day integer is: 2457298 
The Jewish Calendar is: 10/2/2015 

Example: Overflow behavior

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

<?php
//converting an invalid Gregorian 
//date to Julian integer 
$jd = jewishtojd(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 Jewish Calendar
$date = jdtojewish($jd);
  
//prints 0/0/0 as Gregorian 
//month is out of range
echo "The Jewish Calendar is: $date \n"; 
?>

The output of the above code will be:

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

❮ PHP Calendar Reference