I l@ve RuBoard Previous Section Next Section

jdtojewish

string jdtojewish(int JD) 

Converts a Julian day count to a Jewish calendar date of the format MM/DD/YY.

Returns:

Jewish calendar date; 0/0/0 if JD is not a valid Julian day count

Description:

jdtojewish() converts a Julian day count to a Jewish calendar date string. The format of the date string is MM/DD/YY.

The Jewish calendar is a fascinating, unique, and thoroughly non-secular calendar—almost the antithesis of the French calendar. It's ancient and follows both lunar and solar cycles, flexing and bending to match the seasons and religious life of the Jewish people. These factors make it quite complex to work with or even adequately describe. However, detailed resources can be found via Internet search engines—a simple search for Jewish calendar should return a plethora of materials on the subject.

The Jewish day doesn't start at midnight (like the Gregorian and Julian calendar days) or noon (like Julian days); instead, the day starts at sundown (or, in some areas and on some occasions, when a certain group of three stars is visible). Keep this in mind when making conversions between other calendar systems and the Jewish calendar.

Note:

This function is fairly forgiving in one way. If the date specified is invalid for the month specified, but still falls between 1 and 30, the function returns a valid Julian day count. The count is for the month after the specified month, with the day of the month set to the specified day, minus the actual number of days in the specified month.

In practical terms, if you specify the 30th day of a month that only has 29 days, the function returns the Julian day count for the first day of the next month. If we were working with the Gregorian calendar, this would be like specifying February 30th—the function would assume that you meant March 1st or 2nd (depending on the year).


Version:

3+, 4+

See also:

To convert a Jewish calendar date to a Julian day count:

jewishtojd() 

To get a Julian day count from another calendar system, see the various *tojd functions.

Example:

Convert the current Gregorian date to its corresponding Jewish calendar date
// Write a little function to return the proper ordinal suffix for a number 
function get_ordinal_suffix ($number) {
    $last_2_digits = substr (0, -2, $number); 
    if (($number % 10) == 1 && $last_2_digits != 11) 
        return 'st'; 
    if (($number % 10) == 2 && $last_2_digits != 12) 
        return 'nd'; 
    if (($number % 10) == 3 && $last_2_digits != 13) 
        return 'rd'; 
    return 'th'; //default suffix 
} 

// Note: unixtojd is only valid for years 1970 to 2037 
$julian_day = unixtojd (time ()); 

// Find the Jewish calendar date and parse out the day and year values 
list (, $jc_day, $jc_year) = explode ('/', jdtojewish ($julian_day)); 

// Find the Jewish calendar month name 
$jc_month = jdmonthname ($julian_day, 4); 
// Get the English ordinal suffix for the month day 
$ord = get_ordinal_suffix ($jc_day); 

echo "Today is the $jc_day$ord day of $jc_month in the year of $jc_year."; 
    I l@ve RuBoard Previous Section Next Section