PHP jdtojewish() Function

Beginner
5 min read
Updated: Nov 2026
3 examples
Calendar

Definition

In PHP, jdtojewish() converts a Julian Day number into a Jewish (Hebrew) date string.

By default the result is plain month/day/year text with numbers, such as 4/20/5784. You can also ask for the date in Hebrew letters. The Jewish calendar has its own months and its year number is much larger than the Gregorian year.

Syntax

Call jdtojewish() with the values you need. Start with this line.

PHP
$date = jdtojewish($jd);
CallWhat it does
jdtojewish(gregoriantojd(1, 1, 2024))Returns 4/20/5784, which is 20 Tevet 5784.
jdtojewish($jd, true)Returns the date written in Hebrew letters.
jdtojewish(0)Returns 0/0/0 because the day is before the calendar range.

Month numbers start at 1 for Tishri, the month in which the Jewish year begins, so the year number changes in the autumn and not on January 1. In a leap year, month 6 is Adar I and month 7 is Adar II.

Library declarations
PHP
jdtojewish(int $julian_day, bool $hebrew = false, int $fl = 0): string

Parameters

ParameterDescription
julian_dayRequired. The Julian Day number to convert.
hebrewOptional. If true, the date is returned in Hebrew letters (ISO-8859-8 text). The default is false, which returns numbers.
flOptional. Formatting flags for the Hebrew output, such as CAL_JEWISH_ADD_ALAFIM_GERESH, CAL_JEWISH_ADD_ALAFIM and CAL_JEWISH_ADD_GERESHAYIM. The default is 0. It is only used when hebrew is true.

Return Value

Return ValueDescription
stringThe Jewish date as month/day/year text, or Hebrew letters if hebrew is true. It returns 0/0/0 for a Julian Day outside the supported range.

PHP Examples

Example 1 — Gregorian Date to Jewish Date

Convert January 1, 2024 and the start of the Jewish year 5784 into Jewish calendar dates.

PHP
<?php
$jd = gregoriantojd(1, 1, 2024);

echo jdtojewish($jd), PHP_EOL;
echo jdtojewish(gregoriantojd(9, 16, 2023)), PHP_EOL;
var_dump(jdtojewish($jd));

How It Works

  1. gregoriantojd() turns January 1, 2024 into a Julian Day number.
  2. jdtojewish() returns 4/20/5784, which is the 20th day of Tevet (month 4) in the year 5784.
  3. September 16, 2023 was Rosh Hashanah, which is 1 Tishri, so the result is 1/1/5784.
  4. var_dump() shows that the result is a string, not a number.

Example 2 — Leap Years and Invalid Days

The year 5784 is a leap year with two Adar months. Julian Day 0 is outside the supported range.

PHP
<?php
echo jdtojewish(gregoriantojd(3, 24, 2024)), PHP_EOL;
echo jdtojewish(0), PHP_EOL;

How It Works

  1. March 24, 2024 was Purim, which falls on the 14th of Adar.
  2. In the leap year 5784, Adar II is month 7, so the result is 7/14/5784.
  3. In a normal year the same holiday would be in month 6, because there is only one Adar.
  4. Julian Day 0 is before the supported range, so you get 0/0/0.

Example 3 — The Year Changes in Autumn

The Jewish year number does not change on January 1. Look at the days around Rosh Hashanah 2023.

PHP
<?php
$before = gregoriantojd(9, 15, 2023);
$after = $before + 1;

echo jdtojewish($before), PHP_EOL;
echo jdtojewish($after), PHP_EOL;

How It Works

  1. We pick September 15, 2023 and add one day to get September 16.
  2. September 15 is the 29th day of Elul (month 13), the last month of year 5783.
  3. One day later the new year starts, so the result is 1/1/5784.
  4. The year number went up in September, not on January 1.

Frequently Asked Questions

It returns a date in the Jewish calendar. By default this is text in the form month/day/year, for example 4/20/5784.
The Jewish calendar counts years from the traditional date of creation, so the year number is about 3760 higher than the Gregorian year.
Month 1 is Tishri, 2 is Heshvan, 3 is Kislev, 4 is Tevet, 5 is Shevat, 6 is Adar (Adar I in a leap year), 7 is Adar II in a leap year, 8 is Nisan, and so on up to 13, which is Elul.
Pass true as the second argument. The text is in ISO-8859-8 encoding, so convert it to UTF-8 with iconv() or mb_convert_encoding() before showing it on a web page.
Yes. If PHP says jdtojewish() is undefined, enable extension=calendar in php.ini or install the php-calendar package.

Next: jdtojulian()

jdtojulian() converts a Julian Day number into a date in the Julian calendar and returns i.

jdtojulian() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful