What is PhpDig?
PhpDig is a PHP MySQL based
Web Spider & Search Engine.



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


string jdtojewish(JD);
int JD: Julian day count


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


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.


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).


PHP Version: 3+, 4+

See also

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


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


Example 77. 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.";

PHP Functions Essential Reference. Copyright © 2002 by New Riders Publishing (Authors: Zak Greant, Graeme Merrall, Torben Wilson, Brett Michlitsch). This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v1.0 or later (the latest version is presently available at The authors of this book have elected not to choose any options under the OPL. This online book was obtained from and is designed to provide information about the PHP programming language, focusing on PHP version 4.0.4 for the most part. The information is provided on an as-is basis, and no warranty or fitness is implied. All persons and entities shall have neither liability nor responsibility to any person or entity with respect to any loss or damage arising from the information contained in this book.

Powered by: vBulletin Version 3.0.7
Copyright ©2000 - 2005, Jelsoft Enterprises Ltd.
Copyright © 2001 - 2005, ThinkDing LLC. All Rights Reserved.