PHP jdtojewish() Function
The PHP jdtojewish() function converts a Julian Day Count to the Jewish Calendar. The function takes a Julian Day integer and returns the converted Jewish Calendar as a string in the form "month/day/year", or an ISO-8859-8 encoded Hebrew date string, according to the hebrew parameter.
Syntax
jdtojewish(julian_day, hebrew, flags)
Parameters
julian_day |
Required. Specify a Julian day number as integer. |
hebrew |
Optional. If set to true, the flags parameter is used for Hebrew, ISO-8859-8 encoded string based, output format. Default is false. |
flags |
Optional. Specify a bitmask for the Hebrew output format. The available formats are:
|
Return Value
Returns the Jewish Calendar as a string in the form "month/day/year", or an ISO-8859-8 encoded Hebrew date string, according to the hebrew parameter.
Exceptions
NA.
Example:
The example below shows the usage of jdtojewish() 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