Enter a Gregorian date above to convert it to its corresponding Hebrew calendar date.
// — Start of complex Hebrew Calendar Logic —
var HEBREW_MONTH_NAMES_BASE = [
"", // 0-indexed, so 0 is empty
"Nisan", "Iyar", "Sivan", "Tammuz", "Av", "Elul",
"Tishrei", "Cheshvan", "Kislev", "Tevet", "Shevat", "Adar", "Adar II" // Adar II is index 13
];
// Helper function to determine if a Hebrew year is a leap year
function isHebrewLeapYear(year) {
var b = (year * 7 + 1);
return (b % 19 = 18) {
moladDayRaw++;
}
// Calculate day of week for the *deferred* moladDayRaw
// JDN % 7 gives 0=Monday, 1=Tuesday, …, 6=Sunday.
// (JDN + 1) % 7 gives 0=Sunday, 1=Monday, …, 6=Saturday.
var dayOfWeekForMolad = (moladDayRaw + HEBREW_EPOCH + 1) % 7; // 0=Sun, 1=Mon, …, 6=Sat
// Deferral 2: If molad day of week is Sunday, Wednesday, or Friday
if (dayOfWeekForMolad == 0 || dayOfWeekForMolad == 3 || dayOfWeekForMolad == 5) { // Sunday, Wednesday, Friday
moladDayRaw++;
}
// Deferral 3: If molad on Tuesday after 9 AM, and previous year was leap, and current year is not leap.
if (dayOfWeekForMolad == 2 && moladHours >= 9 && !isHebrewLeapYear(year) && isHebrewLeapYear(year – 1)) {
moladDayRaw++;
}
// Deferral 4: If molad on Monday after 18 hours, and current year is not leap, and previous year was not leap.
if (dayOfWeekForMolad == 1 && moladHours >= 18 && !isHebrewLeapYear(year) && !isHebrewLeapYear(year – 1)) {
moladDayRaw++;
}
// Final check for deferral 2 again, as previous deferrals might have changed the day of week
dayOfWeekForMolad = (moladDayRaw + HEBREW_EPOCH + 1) % 7;
if (dayOfWeekForMolad == 0 || dayOfWeekForMolad == 3 || dayOfWeekForMolad == 5) { // Sunday, Wednesday, Friday
moladDayRaw++;
}
return moladDayRaw + HEBREW_EPOCH; // Return JDN of Rosh Hashanah
}
// Convert Julian Day Number to Hebrew Date
function JDNToHebrew(jdn) {
var year = Math.floor((jdn – 347997) / 365.2422) + 1; // Approximation for initial year guess, adjusted
var startOfYearJDN = hebrewCalendarStartOfHebrewYearJDN(year);
// Adjust year until startOfYearJDN is less than or equal to JDN
while (startOfYearJDN > jdn) {
year–;
startOfYearJDN = hebrewCalendarStartOfHebrewYearJDN(year);
}
while (hebrewCalendarStartOfHebrewYearJDN(year + 1) <= jdn) {
year++;
startOfYearJDN = hebrewCalendarStartOfHebrewYearJDN(year);
}
var dayOfYear = jdn – startOfYearJDN; // 0-indexed day of year
var daysInYear = daysInHebrewYear(year);
var isLeap = isHebrewLeapYear(year);
var monthLengths = [];
monthLengths[1] = 30; // Nisan
monthLengths[2] = 29; // Iyar
monthLengths[3] = 30; // Sivan
monthLengths[4] = 29; // Tammuz
monthLengths[5] = 30; // Av
monthLengths[6] = 29; // Elul
monthLengths[7] = 30; // Tishrei
// Cheshvan and Kislev vary based on year length
if (daysInYear == 353 || daysInYear == 383) { // Deficient year
monthLengths[8] = 29; // Cheshvan
monthLengths[9] = 29; // Kislev
} else if (daysInYear == 354 || daysInYear == 384) { // Regular year
monthLengths[8] = 29; // Cheshvan
monthLengths[9] = 30; // Kislev
} else if (daysInYear == 355 || daysInYear == 385) { // Full year
monthLengths[8] = 30; // Cheshvan
monthLengths[9] = 30; // Kislev
}
monthLengths[10] = 29; // Tevet
monthLengths[11] = 30; // Shevat
if (isLeap) {
monthLengths[12] = 30; // Adar I
monthLengths[13] = 29; // Adar II
} else {
monthLengths[12] = 29; // Adar (in non-leap year)
}
var monthIndex = 0; // Will be set to the correct month number (1-13)
var day = 0; // Day of month (1-indexed)
// Iterate through months in their calendar order (Tishrei to Elul)
var currentDayCount = 0;
var monthOrder = [7, 8, 9, 10, 11, 12]; // Tishrei to Adar/Adar I
if (isLeap) {
monthOrder.push(13); // Adar II
}
monthOrder = monthOrder.concat([1, 2, 3, 4, 5, 6]); // Nisan to Elul
for (var i = 0; i < monthOrder.length; i++) {
var mIdx = monthOrder[i];
var len = monthLengths[mIdx];
if (dayOfYear < currentDayCount + len) {
monthIndex = mIdx;
day = dayOfYear – currentDayCount + 1;
break;
}
currentDayCount += len;
}
var hebrewMonthName = HEBREW_MONTH_NAMES_BASE[monthIndex];
if (isLeap) {
if (monthIndex == 12) hebrewMonthName = "Adar I";
if (monthIndex == 13) hebrewMonthName = "Adar II";
} else {
if (monthIndex == 12) hebrewMonthName = "Adar";
}
return {
year: year,
month: hebrewMonthName,
day: day,
isLeapYear: isLeap
};
}
// Convert Gregorian Date to Julian Day Number
function gregorianToJDN(year, month, day) {
var a = Math.floor((14 – month) / 12);
var y = year + 4800 – a;
var m = month + 12 * a – 3;
return day + Math.floor((153 * m + 2) / 5) + 365 * y + Math.floor(y / 4) – Math.floor(y / 100) + Math.floor(y / 400) – 32045;
}
// — End of complex Hebrew Calendar Logic —
function calculateJewishDate() {
var gregorianDay = parseInt(document.getElementById("gregorianDay").value);
var gregorianMonth = parseInt(document.getElementById("gregorianMonth").value);
var gregorianYear = parseInt(document.getElementById("gregorianYear").value);
var resultDiv = document.getElementById("result");
resultDiv.innerHTML = ""; // Clear previous results
// Input validation
if (isNaN(gregorianDay) || isNaN(gregorianMonth) || isNaN(gregorianYear) ||
gregorianDay 31 ||
gregorianMonth 12 ||
gregorianYear < 1) {
resultDiv.innerHTML = "Please enter valid Gregorian date values.";
return;
}
// Basic date validity check (e.g., Feb 30)
var date = new Date(gregorianYear, gregorianMonth – 1, gregorianDay);
if (date.getFullYear() !== gregorianYear ||
date.getMonth() !== gregorianMonth – 1 ||
date.getDate() !== gregorianDay) {
resultDiv.innerHTML = "The Gregorian date entered is not a valid date.";
return;
}
// Perform conversion
var jdn = gregorianToJDN(gregorianYear, gregorianMonth, gregorianDay);
var hebrewDate = JDNToHebrew(jdn);
// Determine day of the week
// JDN % 7 gives 0=Monday, 1=Tuesday, …, 6=Sunday.
// Hebrew week starts Sunday (0). So, (JDN + 1) % 7 maps JDN to 0=Sunday, 1=Monday, …, 6=Saturday.
var dayOfWeekIndex = (jdn + 1) % 7;
var hebrewDaysOfWeek = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Shabbat"];
var dayOfWeek = hebrewDaysOfWeek[dayOfWeekIndex];
var output = "
Converted Hebrew Date:
";
output += "" + hebrewDate.day + " " + hebrewDate.month + ", " + hebrewDate.year + "";
output += "Day of the week: " + dayOfWeek + "";
if (hebrewDate.isLeapYear) {
output += "(This is a Hebrew leap year)";
}
resultDiv.innerHTML = output;
}
// Set current date as default
window.onload = function() {
var today = new Date();
document.getElementById("gregorianDay").value = today.getDate();
document.getElementById("gregorianMonth").value = today.getMonth() + 1; // Month is 0-indexed
document.getElementById("gregorianYear").value = today.getFullYear();
calculateJewishDate(); // Calculate on load
};
Understanding the Jewish Date Calculator
The Jewish Date Calculator is a specialized tool designed to convert dates between the Gregorian calendar (the civil calendar used worldwide) and the Hebrew calendar. This conversion is essential for observing Jewish holidays, lifecycle events like Bar/Bat Mitzvahs and Yahrzeits (anniversaries of a death), and understanding historical Jewish dates.
The Hebrew Calendar: A Lunisolar System
Unlike the Gregorian calendar, which is purely solar, the Hebrew calendar is a lunisolar calendar. This means it tracks both the cycles of the moon (for months) and the sun (for years). Each month begins with the appearance of the new moon, and a leap month (Adar I) is added seven times in a 19-year cycle to ensure that the lunar year stays aligned with the solar year and that holidays fall in their correct seasons.
Lunar Months: Months are either 29 or 30 days long, approximating the lunar cycle.
Solar Years: The year is adjusted to the solar cycle to ensure Passover falls in spring and Sukkot in autumn.
Rosh Chodesh: The beginning of each new month is called Rosh Chodesh, marked by the new moon.
Year Numbering: The Hebrew calendar counts years from the creation of the world, according to rabbinic chronology. For example, the year 2024 CE corresponds to the Hebrew year 5784-5785.
How the Calculator Works
This calculator takes a standard Gregorian date (Day, Month, Year) as input. It then performs a complex series of calculations based on established Hebrew calendar algorithms to determine the corresponding Hebrew date. These algorithms account for:
Julian Day Number (JDN) Conversion: First, the Gregorian date is converted into a Julian Day Number, a continuous count of days since a specific epoch. This provides a universal reference point.
Molad of Tishrei: The core of the Hebrew calendar calculation involves determining the precise moment of the Molad (conjunction of the moon) for Tishrei (the seventh month, which marks the start of the new year, Rosh Hashanah).
Rosh Hashanah Deferrals: Specific rules dictate that Rosh Hashanah cannot fall on certain days of the week (Sunday, Wednesday, or Friday) to prevent certain holidays from clashing or falling on consecutive Sabbaths. These "deferral rules" can shift Rosh Hashanah by a day or two.
Year Length Determination: Based on the Molad and deferral rules, the exact number of days in the Hebrew year is determined. This can be 353, 354, or 355 days for a common year, or 383, 384, or 385 days for a leap year. This variability affects the lengths of the months Cheshvan and Kislev.
Month and Day Calculation: Finally, the calculator iterates through the months of the Hebrew year, using their standard or adjusted lengths, to pinpoint the exact Hebrew day and month corresponding to the input JDN.
Example Calculation
Let's say you want to find the Hebrew date for January 1, 2024:
Input: Gregorian Day: 1, Gregorian Month: 1, Gregorian Year: 2024
The calculator processes these inputs through the complex algorithms.
Output: The result would be 20 Tevet, 5784, and the day of the week would be Monday. (Note: 5784 was a regular year, not a leap year).
This calculator provides a precise way to navigate the intricacies of the Hebrew calendar, making it easier to plan for and observe Jewish traditions and events.