Latest Kiddush Levana Time – Location, Location, Location

The full moon visible from the Inbal hotel sukkah.

In the previously published Zmanim For Kiddush Levana Before Shavuos 5778 article, we demonstrated how location plays a key role in the earliest time one can recite Kiddush Levana / קידוש לבנה. This article will focus on the Sof Zman Kiddush Levana, or the latest that one can recite Kiddush Levana. In the past we posted the technical Calculating Kiddush Levana Times Using the Zmanim API post, with a simple example of using the KosherJava Zmanim API to calculate Kiddush Levana. Here is a slightly more complex example.
The Bach on the Tur Hilchos Kiddush Hachodesh (Orach Chayim 426 תכ”ו) discusses not reciting Kiddush Levana on Yom Tov.

גם נוהגים שאין מקדשין אותה במ״ש שחל בו י״ט כי כן כתב מהרי״ל בסוף הלכות שבועות ובשנת ש״ץ לא היתה נראה הלבנה במוצאי י״כ וגם אח״כ לא היתה נראה עד ליל ט״ו והיינו מקדשין אותה בליל י״ט ולא חששנו על החילוקים כי אין זה אלא קפידא בעלמא כאילו יצא מחוץ לתחום למעלה מעשרה במחשבה להקביל פני השכינה ואין להקפיד אלא לכתחלה דאפשר לקדשה אח”כ כגון שבועות כשחל א״ב אבל בליל ט״ו דסוכות דלא אפשר לברך בלילה שלאחריו דכבר נתמלא פגימתה יש לברך בליל ט״ו

He writes that in Tishrei 5390 (1629) there was cloud cover from Yom Kippur until the first night of Succos. The Bach who was the Rabbi in Kraków at that time (see the Be’er Haitev 426:5), writes that they said Kiddush Levana on the first night of Sukkos. This is right after he mentioned that it is our custom not to recite Kiddush Levana after halfway between molad and molad (following the Maharil and Rema, and not the Mechaber who allows a little extra time). Was tzais (the earliest time to recite Kiddush Levana), on the first night of Succos in Kraków that year (5390 / 1629) after the midpoint between molad and molad? Is the Bach saying that in this case bedieved you should still recite Kiddush Levana, or is he just saying that it can be said on Yom Tov when waiting until after Yom Tov will be too late?

The Impact of Calendar Dechiyos / דחיות

The day of the molad of Tishrei is the target day for the first day of Rosh Hashana. However, the Jewish calendar has four rules that delay the start of the Jewish year by a day or two (in a case of two delays combining), a subject that we will hopefully cover at some point – עוד חזון למועד. If not for these delays known as dechiyos that occur about 60% of all years, the 15th night of the month of Tishrei, would always be early enough to recite Kiddush Levanah. The average lunar month is a drop over 29 and a half days (29 days, 12 hours, 44 minutes and 3.3 seconds), so the halfway point that is the end of the earlier time quoted by the Bach would be 14 days, 18 hours and 22 minutes after the molad. The calculation below shows that in the case of 15 Tishrei, 5390 (the evening of Oct 1, 1629), even the earlier zman for sof zman Kiddush Levana did not happen until the morning of the first day of Succos. The molad of Tishrei that year was about 2.5 hours before the day’s end. This resulted in a dechiya of Molad Zaken / מולד זקן. This delayed Rosh Hashanah by a day pushing it from Monday to Tuesday. There was no dechiya of Lo ADU Rosh / לא אד״ו ראש, so the delay was not as long as it could have been (had there been a combination of the two dechiyos). Sunset on the first night of Sukkos that year in Krakow was at 5:18 pm (using standard time), and the moon rose at 5:54 pm, so they were able to recite Kiddush Levana that night.

Despite dechiyos, the time of tzais in Krakow is before sof zman Kiddush Levana on the first night of Succos approximately 73% of the time, making the ability to recite Kiddush Levanah on the first night of Sukkos for the longitude of Krakow (that is close to Yerushalayim) more common than not. As you will see below, the farther west you go, the less likely it is to happen.

Sof Zman Kiddus Levana Around the World

Being that Sof Zman Kiddush Levana is a fixed time globally, and can’t be said before local tzais, the farther west you are, the less of a probability you have of encountering a late Kiddush Levana. Conversely, the farther east you are, the greater your probability is of encountering a late Kiddush Levana. The chart below was inspired by Rabbi Dovid Heber’s example in his sefer Shaarei Zmanim of the rare ability to recite Kiddush Levana on the 17th of the month in Anadyr, Russia. This town is at the far eastern portion of Russia, not far from the International Date Line. The chart shows the percentage of times that Sof Zman Kiddush Levana in Tishrei and the annual average for various places around the world occurs after tzais (calculated as 8.5°) on the 15th, 16th and 17th of the month.

15thט״ו 16thט״ז 17thי״ז
Location תשרי All תשרי All תשרי All
Anadyr, Russia 91% 57% 46% 18% N/A 0.2%
Sydney, Australia 88% 73% 42% 21% N/A N/A
Yerushalayim 75% 57% 24% 8% N/A N/A
Krakow, Poland 73% 55% 22% 7% N/A N/A
Lakewood, NJ 62% 41% 8% 1.6% N/A N/A
Los Angeles, CA 56% 35% 3% 0.7% N/A N/A
Kurima Island, Japan
(Chazon Ish)
39% 18% N/A N/A N/A N/A

Molad Calculation Code Sample

The code below shows rudimentary use of the Jewish Calendar functionality and molad retrieval for the historical date of the Bach’s 1629 Sukkos night kiddush levanah.

int month = JewishDate.TISHREI;
int year = 5390;
JewishDate erevSukkos = new JewishDate(year, JewishDate.TISHREI, 14);
JewishDate molad = JewishDate.getMolad(year, month);
Date tchilas3Days = JewishCalendar.getTchilasZmanKidushLevanah3Days(year, month);
Date tchilas7Days = JewishCalendar.getTchilasZmanKidushLevanah7Days(year, month);
Date sofZmanBetweenMoldos = JewishCalendar.getSofZmanKidushLevanahBetweenMoldos(year, month);
Date sofZmanKidushLevanah15Days = JewishCalendar.getSofZmanKidushLevanah15Days(year, month);
TimeZone krakowTZ = TimeZone.getTimeZone("Europe/Warsaw");
SimpleDateFormat sdf = new SimpleDateFormat("MMM dd, yyyy 'at' HH:mm:ss z");
SimpleDateFormat dayFormat = new SimpleDateFormat("MMM dd, yyyy");
sdf.setTimeZone(krakowTZ);
System.out.println("Molad: " + molad + " / " + dayFormat.format(molad.getTime()) + ", day of week: "
		+ molad.getDayOfWeek() + ", Hours: " + molad.getMoladHours() + ", minutes: " + molad.getMoladMinutes()
		+ ", Chalakim: " + molad.getMoladChalakim());
System.out.println("Tchilas Zman Kidush Levanah 3 Days: " + sdf.format(tchilas3Days));
System.out.println("Tchilas Zman Kidush Levanah 7 Days: " + sdf.format(tchilas7Days));
System.out.println("Erev Succos: " + erevSukkos + " / " + dayFormat.format(erevSukkos.getTime()));
System.out.println("Sof Zman KidushLevanah Between Moldos: " + sdf.format(sofZmanBetweenMoldos));
System.out.println("Sof Zman Kidush Levanah 15 Days: " + sdf.format(sofZmanKidushLevanah15Days));

The output in Central European Time (CET) is:

Molad: 29 Elul, 5389 / Sep 17, 1629, day of week: 2, Hours: 15,
        minutes: 46, Chalakim: 5
Tchilas Zman Kidush Levanah 3 Days: Sep 20, 1629 at 14:25:19 CET
Tchilas Zman Kidush Levanah 7 Days: Sep 24, 1629 at 14:25:19 CET
Erev Succos: 14 Tishrei, 5390 / Oct 01, 1629
Sof Zman KidushLevanah Between Moldos: Oct 02, 1629 at 08:47:21 CET
Sof Zman Kidush Levanah 15 Days: Oct 02, 1629 at 14:25:19 CET

Odds & Ends

While Tishrei has much higher odds than most months for a late Sof Zman Kiddush Levana, Shevat is very close to Tishrei, and sometimes exceeds it. Cheshvan and Kislev are the only variable length Jewish months. In a chaser (Deficient / short) year they will both have the short month length of 29 days. The months of Cheshvan and Kislev are followed by Teves that is always 29 days. With the possibility of three 29-day months in a row and being in the winter with early tzais times, the month of Shevat is the most likely to have a very late sof zman Kiddush Levana, as pointed out by Rabbi Heber in his Shaarei Zmanim.

The reason that Anadyr only has a 57% chance of being able to recite Kiddush Levana year-round on the 15th VS 73% in Sydney, even though Anadyr is 3% more likely to have Kiddush levana on the 15th of Tishrei, is due to the high latitude of Anadyr (64.7° N) that results in 25.4% of the months not having tzais on the 15th.

The closest case to almost not being able to recite Kiddush levanah on the 15th of Tishrei without dechiyos would be in a location immediately to the east of the Chazon Ish dateline such as Kurima Island on a year when the molad was exactly at sunset in Yerushalayim and the true opposition (full moon) was much earlier than the average opposition, causing the moon to rise after sof zman kidush levana. Calculations show that this would never actually happen on Sukkos though it is likely to occur on Pesach since the molad of Nisan is much more likely to be before Rosh Chodesh.

Baal Hatanya’s Zmanim Added to KosherJava Zmanim Library

Baal Hatanya Zmanim (Photo With Hourglass)
While most calendars list the גר״א Gra and בעל התניא Baal Hatanya zmanim as identical, things are not that simple. Both are based on a day being from sunrise to sunset, but recently some Chabad calendars started using slightly different calculations for the Baal Hatanya’s zmanim. It should be noted that these zmanim are not universally accepted in Chabad (see the Opposing View section below). According to the Baal Hatanya in the סדר הכנסת שבת Seder Hachnasas Shabbos,

Seder Hachnasas Shabbos -Shkiah Amitis

מאד מאד צריך ליזהר בהדלקת נרות להדליק קודם שקיעת החמה, שקיעה הניראית, דהיינו בעוד השמש זורח בראשי האילנות בשדה בארץ המישור שאין שום הר במערב, או בראשי גגים הגבוהים בעיר, ולא לעשות אחר כך שום מלאכה כלל, כדי להוסיף מחול על הקודש מעט. כי אחר סילוק וביאת האור מראשי האילנות וגגים הגבוהים בכמו ד׳ חלקי ששיים משעה (שקורין מינוטין) אזי היא שקיעה האמיתית, שהוא סילוק וביאת האור מראשי ההרים הגבוהים שבארץ ישראל.

zmanim are calculated based on a 4 minute delay in shkiah. These 4 minutes are calculated as the sun’s position in degrees before sunrise and after sunset. While Chabad considers netz (also known as hanetz) as standard sunrise and shkiah as standard sunset, this is lechumra, and other zmanim are based on a slightly earlier sunrise and a slightly later sunset.

About 3 1/2 years ago, I posted information on calculating the Baal Hatanya’s Shkiah. That article was focused on a software developer’s perspective and explained how to use the existing API to calculate a fixed clock 4 minute zman that was not natively supported by the KosherJava zmanim library. Recently Yechiel Paricher contributed code to the KosherJava zmanim API/Library that added native support for various Baal Hatanya zmanim. This will enable users of the Zmanim library to easily include Baal Hatanya zmanim in their software.

According to the Baal Hatanya, shkiah amitis (true halachic sunset) is defined as:

כי אחר סילוק וביאת האור מראשי האילנות וגגים הגבוהים בכמו ד׳ חלקי ששיים משעה (שקורין מינוטין) אזי היא שקיעה האמיתית, שהוא סילוק וביאת האור מראשי ההרים הגבוהים שבארץ ישראל.

The time is calculated as the point at which the center of the sun’s disk is 1.583° below the horizon. Chabad applies the same degree based offset to netz amiti (true halachic sunrise). This degree based calculation can be found in Rabbi Shalom DovBer Levine’s commentary on The Baal Hatanya’s Seder Hachnasas Shabbos. From an elevation of 546 meters at the top of Har Hacarmel (based on the Gemara Shabbos 35a), the sun disappears at sunset when it is 1.583° (1° 35′) below the sea level horizon. There are other opinions that are not included in the code (but can easily be calculated using the API). One such example is a very similar (degree-wise) netz amiti from Rabbi Yosef Yitzchok Feigelstock. Rabbi Feigelstock calculates shkiah amitis as the degrees below the horizon 4 minutes after sunset in Yerushalaym (on the equinox). That degree based zman is listed in his letter to Rabbi Levine published in the back of the Seder Hachnasas Shabbos as 1.583°. The 1.583° is a typo (confirmed by Rabbi Feigelstock since it is identical to the 1° 35′ zman) and should be 1.683°. The calculations added to the KosherJava Zmanim library are used by most Chabad calendars that follow the Baal Hatanya’s Zmanim. See About Our Zmanim Calculations @ Chabad.org.

Zmanim based on shaos zmaniyos are based on a day between netz amiti and shkiah amitis calculated as 1.583° below the horizon. The various Baal Hatanya zmanim now part of the zmanim library include:

  • Alos 16.9° – based on the sun’s position below the horizon 72 minutes before netz amiti in Yerushayim around the equinox.
  • Sunrise or netz amiti – calculated as 1.583° below the horizon. This method is private and is only used as a base for other calculations.
  • Sof Zman Shma – calculated as 3 shaos zmaniyos (or a 1/4 of the day) after netz amiti.
  • Sof Zman Tfila – calculated as 4 shaos zmaniyos (or a 1/3 of the day) after netz amiti.
  • Sof Zman Achilas Chametz – calculated as 4 shaos zmaniyos (or a 1/3 of the day) after netz amiti.
  • Sof Zman Biur Chametz – calculated as 5 shaos zmaniyos after netz amiti.
  • Mincha Gedola – calculated as 6.5 shaos zmaniyos after netz amiti.
  • Mincha Gedola – Greater Than 30 – As above, but with a minimum 30 clock minutes after chatzos.
  • Mincha Ketana – calculated as 9.5 shaos zmaniyos after netz amiti.
  • Plag Hamincha – calculated as 10.75 shaos zmaniyos after netz amiti.
  • Sunset or shkiah amitis – calculated as 1.583° below the horizon. This method is private and is only used as a base for other calculations.
  • Tzais – calculated as the time when the sun is 6° below the western horizon. Note that as per Rabbi Yosef Yitzchok Feigelstock, for Motzai Shabbos, Motzai Yom Kippur and Motzai Yom Tov, the 8.5° time should be used. The time between 6° and 8.5° is part of tosfos Shabbos and tosfos Yom Kippur. Other zmanim such as zman krias shema can use the 6° zman. The 8.5° zman has always been part of the API, and sample code for calculating tzais 8.5° can be seen below.

These zmanim (not my implementation) that Chabad.org spent 2 years researching, have a haskama (endorsement) from Chabad Dayanim. Chabad.org zmanim do not provide seconds (appropriate due to expected refraction variances), but with the rounding rules provided by Rabbi Mordechai Sandhaus, the lead developer at Chabad.org, I was able to confirm that the Baal Hatanya zmanim generated by the KosherJava zmanim library match the Chabad.org times.

Please note that there are various Chabad shittos for netz, shkiah and tzais zmanim. The above are the commonly used ones. Other opinions on Baal Hatanya based zmanim that are less commonly used are not included in the API, but given the flexibility of the KosherJava Zmanim API they can easily be calculated.These include:

  • Netz Amiti 1.683° as calculated by Rabbi Feigelstock and mentioned above (only used for calculating other zmanim).
  • Shkiah Amitis 1.683° as calculated by Rabbi Feigelstock and mentioned above (only used for calculating other zmanim).
  • Tzais 5.833° as calculated by Rabbi Shalom DovBer Levine lekula for derabanans.
  • Tzais 6.3° as calculated by Rabbi Avrohom Altein, Chabad of Winnipeg, Manitoba, Canada.
  • Tzais 6.833° as calculated by Rabbi Shalom DovBer Levine lechumra for deoraysas.
  • Tzais 8.5° as commonly used by Chabad lechumra and mentioned above.

Code samples for these zmanim can be seen below.

Opposing Views

The relatively new calculations of zmanim based on netz amiti and shkiah amitis are not universally accepted in Chabad. Rabbi Avrohom Altein, the Rov of Chabad of Winnipeg, Manitoba, mentioned in a correspondence, that it is difficult to accept these new zmanim calculations as is.

The Alter Rebbe only speaks explicitly of shkiya amitis in regards to the beginning of Shabbos. We can draw comparisons to other areas of halacha but those comparisons needs to be carefully evaluated.
I believe that the Alter Rebbe does not calculate shaos zmaniyos based on netz & shkiya amitis, but rather on the standard netz & shkiya. There are several strong proofs to this. In earlier years, all of Chabad calculated shaos zmaniyos for laws of chometz, reading Shema etc., on the basis of standard sunrise and sunset and I believe that’s how the older Colel Chabad Luchos did the calculation. In recent years, this has changed in the Colel Chabad Luchos and chabad.org based on the opinion of Rabbi SDB Levin and Rabbi Feigeslstock — but there are Chabad rabbis that do not agree with their interpretation.

Code Samples

For developers, here is sample code that calculates the new zmanim. This should allow many zmanim apps to add Baal Hatanya zmanim with very little effort.

String locationName = "770 Eastern Parkway";
double latitude = 40.669;
double longitude = -73.943;
double elevation = 30;
TimeZone timeZone = TimeZone.getTimeZone("America/New_York");
GeoLocation location = new GeoLocation(locationName, latitude, longitude, elevation, timeZone);
ComplexZmanimCalendar czc = new ComplexZmanimCalendar(location);
czc.getCalendar().set(1994, Calendar.JUNE, 12);
System.out.println("Alos: " + czc.getAlosBaalHatanya()); //16.9 degrees
System.out.println("Sunrise: " + czc.getSunrise()); //standard sunrise
System.out.println("Sof Zman Shma: " + czc.getSofZmanShmaBaalHatanya());
System.out.println("Sof Zman Tfila: " + czc.getSofZmanTfilaBaalHatanya());
System.out.println("Sof Zman Achilas Chametz: " + czc.getSofZmanAchilasChametzBaalHatanya()); //only use on Erev Pesach
System.out.println("Sof Zman Biur Chametz: " + czc.getSofZmanBiurChametzBaalHatanya()); //only use on Erev Pesach
System.out.println("Mincha Gedola: " + czc.getMinchaGedolaBaalHatanya());
System.out.println("Mincha Gedola Min 30: " + czc.getMinchaGedolaBaalHatanyaGreaterThan30());
System.out.println("Mincha Ketana: " + czc.getMinchaKetanaBaalHatanya());
System.out.println("Plag Hamincha: " + czc.getPlagHaminchaBaalHatanya());
System.out.println("Sunset: " + czc.getSunset()); //standard sunset
System.out.println("Tzais Baal Hatanya: " + czc.getTzaisBaalHatanya()); //6° degrees
System.out.println("Tzais 8.5°: " + czc.getTzaisGeonim8Point5Degrees()); //8.5° degrees lechumra commonly used by Chabad
System.out.println("Shaah Zmanis Baal Hatanya: " + czc.getShaahZmanisBaalHatanya());

Calculating other Baal Hatanya based zmanim not included in the library are very simple. Here are a few examples

System.out.println("Netz Amiti 1.683°: " + czc.getSunriseOffsetByDegrees(90 + 1.683)); //Rabbi Feigelstock netz amiti (only used for calculating other zmanim)
System.out.println("Shkiah Amitis 1.683°: " + czc.getSunsetOffsetByDegrees(90 + 1.683)); //Rabbi Feigelstock shkiah amitis (only used for calculating other zmanim)
System.out.println("Tzais 5.833°: " + czc.getSunsetOffsetByDegrees(90 + 5.833)); //Rabbi Levine lekula for derabanans
System.out.println("Tzais 6.3°: " + czc.getSunsetOffsetByDegrees(90 + 6.3)); //Rabbi Avrohom Altein
System.out.println("Tzais 6.833°: " + czc.getSunsetOffsetByDegrees(90 + 6.833)); //Rabbi Levine lechumra for deoraysas

I would like to thank Rabbi Yosef Yitzchok Feigelstock, the Rov of Chabad in Buenos Aires, Rabbi Avrohom Altein, the Rov of Chabad in Winnipeg and Rabbi Mordechai Sandhaus, the lead developer at Chabad.org for reviewing this post.

FAQ: Different Parshas Hashavua in Eretz Yisrael Than Chutz La’aretz

KosherJava Zmanim API FAQ

Question:

Why does the KosherJava Zmanim API seem to sometimes return the incorrect parshas hashavua in Israel?

Answer:

I have had a number of inquiries this year about the incorrect Parshas Hashavua being returned by the API. In all cases this has been a complaint for Eretz Yisrael and not Chutz La’aretz. The explanation is pretty simple and covered in the API documentation for the JewishCalendar class, but may not be clear to all. When the first day of Pesach occurs on a Shabbos, as it did this year (5775), the last day of Pesach in Eretz Yisrael is on a Friday. The following day is a regular Shabbos in Eretz Yisrael with the usual krias hatorah, but in chutz la’aretz it is the 8th day of Pesach, resulting in krias Hatorah for Pesach. The following weeks will have different krias HaTorah in Eretz Yisrael vs chutz la’aretz, and this will continue for a number of weeks until a double parsha in chutz laaretz is added to equalize the parsha. This last occurred in 2012 (before the release of the calendar functionality in the Zmanim 1.3 release) and will occur again next year. If you are coding to display the Parshas Hashavuah for use in Israel, it is important to set the inIsrael(true) flag (it has a default of false).

JewishDate.setInIsrael(true);

A fuller example showing how to set the indicator and showing the comparison of Eretz Yisrael and Chutz Laaretz this year can be seen in this example.

JewishCalendar israelCalendar = new JewishCalendar(5775, JewishDate.NISSAN, 7);
israelCalendar.setInIsrael(true); //set the calendar to Israel
JewishCalendar chutsLaaretzCalendar = new JewishCalendar(5775, JewishDate.NISSAN, 7);
chutsLaaretzCalendar.setInIsrael(false); //not really needed since the API defaults to false
HebrewDateFormatter hdf = new HebrewDateFormatter();
System.out.println("Date\tChutz Laaretz / Eretz Yisrael"));
for(int i = 0; i < 57; i++){
	israelCalendar.forward(); //roll the date forward a day
	chutsLaaretzCalendar.forward(); //roll the date forward a day
	if(chutsLaaretzCalendar.getDayOfWeek() == 7){ //ignore weekdays
		System.out.println(hdf.formatParsha(chutsLaaretzCalendar) + "\t" + hdf.formatParsha(israelCalendar) + " \\ " + hdf.format(chutsLaaretzCalendar));
	}
}

the output of this is

Date               Chutz Laaretz / Eretz Yisrael
8 Nissan, 5775     Tzav / Tzav
15 Nissan, 5775     / 
22 Nissan, 5775     / Shmini
29 Nissan, 5775    Shmini / Tazria Metzora
6 Iyar, 5775       Tazria Metzora / Achrei Mos Kedoshim
13 Iyar, 5775      Achrei Mos Kedoshim / Emor
20 Iyar, 5775      Emor / Behar
27 Iyar, 5775      Behar Bechukosai / Bechukosai
5 Sivan, 5775      Bamidbar / Bamidbar

It should be noted that this discrepancy is not rare and happens about 25% of the calendar years.

FAQ: Calculating the Baal Hatanya’s Shkiah

Baal Hatanya Zmanim

Please see the more recent and updated article Baal Hatanya’s Zmanim Added to KosherJava Zmanim Library for more current information.

Question:

How do I calculate the בעל התניא Baal Hatanya’s Zman for Shkiah as 4 minutes after sunset using the KosherJava Zmanim API?

Answer:

I was recently asked how to use the Zmanim API to calculate the Baal Hatanya’s opinion is that shkiah (halachic sunset) is 4 minutes after civil sunset. The assumption that the Baal Hatanya’s shkiah is a fixed 4 minutes after sunset is not that simple and will require a separate post to clarify. This zman should not be used lehalacha without consulting a rov. This post shows how to us the API assuming that it is a fixed 4 minutes after sunset. The technique to calculate this with the API is identical to the way getTzais72() would be calculated. The source of that method is

public Date getTzais72() {
return getTimeOffset(getSeaLevelSunset(), 72 * MINUTE_MILLIS);
}

The getTimeOffset(Date time, double offset) method in the base class AstronomicalCalendar is very simple:

public Date getTimeOffset(Date time, long offset) {
if (time == null || offset == Long.MIN_VALUE) {
return null;
}
return new Date(time.getTime() + offset);
}

The getTimeOffset method simply adds the number of milliseconds of the offset to the raw time of the zman and returns it as a date. While using the API itself is not needed for such a simple calculation, here is how it would be used:

String locationName = "Jerusalem";
double latitude = 31.778; // Har habayis
double longitude = 35.2354;// Har Habayis
double elevation = 0;
TimeZone timeZone = TimeZone.getTimeZone("Asia/Jerusalem");
GeoLocation location = new GeoLocation(locationName, latitude, longitude, elevation, timeZone);
ZmanimCalendar zc = new ZmanimCalendar(location);
Date baalHatanyaShkiah = zc.getTimeOffset(zc.getSeaLevelSunset(), 4 * 60000);
System.out.println("Baal Hatanya Shkiah: " + baalHatanyaShkiah);

Adding it to the API itself would be even simpler:

public Date getShkiahBaalHatanya() {
return getTimeOffset(getSeaLevelSunset(), 4 * MINUTE_MILLIS);
}

At some point in the future I may (doubtful) add this time to the API itself. The zman is not commonly used, and the Chabad calendars that I have seen all use regular sunset.

Update on ‍‍July 5, 2015 – י״ח תמוז תשע״ה: This article was updated to clarify that the Baal Hatanya’s opinion may not be a fixed 4 minutes, but that the post was showing how to use the API to calculate it based on the questioner’s assumption that it was a 4 minute zman.
Update on Dec 14, 2018 – ו׳ טבת תשע״ט: This article was superseded with the more recent and corrected article Baal Hatanya’s Zmanim Added to KosherJava Zmanim Library.

Using the Zmanim API 1.3.0 Jewish Calendar Code

Sunrise CalendarThe recently released Zmanim API 1.3.0 added Jewish calendar support to the API. Previously, the API had zmanim support, but no Jewish calendar support. While the calendar code is in beta mode and is subject to API changes, below are some simple code examples using the current 1.3.0 release. These examples of the use of the JewishCalendar and HebrewDateFormatter classes do not fully cover the functionality available in the Zmanim API. Please read the JavaDocs and experiment. Please let me know if there are any calendar related items that you feel should change or be added to the API.

Setting and outputting formatted dates

JewishCalendar jd = new JewishCalendar(); // current date 23 Nissan, 5773
HebrewDateFormatter hdf = new HebrewDateFormatter();
System.out.println(jd); // prints hebrew date in English chars - 23 Nissan, 5773
hdf.setHebrewFormat(true); // change formatting to Hebrew
System.out.println(hdf.format(jd)); // date formatted in Hebrew
jd.setJewishDate(5729, JewishDate.SHEVAT, 21); // set the date to 21 Shevat, 5729
System.out.println(hdf.format(jd)); // date formatted in Hebrew
jd.setJewishDate(5772, JewishDate.NISSAN, 18); // set date to third day of Pesach
System.out.println(hdf.format(jd));
System.out.println(hdf.formatYomTov(jd)); //output Chol Hamoed Pesach in Hebrew
hdf.setHebrewFormat(false); // change formatting to default
System.out.println(hdf.format(jd)); // prints Hebrew date in English chars - 18 Nissan, 5772
System.out.println(hdf.formatYomTov(jd)); //output Chol Hamoed Pesach

Output:

23 Nissan, 5773
כ״ג ניסן תשע״ג
כ״א שבט תשכ״ט
י״ח ניסן תשע״ב
חול המועד פסח
18 Nissan, 5772
Chol Hamoed Pesach

Parshas Hashavua

Please note that the parsha will only input if the date is a Shabbos. This is something that may change down the line.

HebrewDateFormatter hdf = new HebrewDateFormatter();
JewishCalendar jd = new JewishCalendar(5773, JewishDate.NISSAN, 12);
System.out.println(hdf.formatParsha(jd));
hdf.setHebrewFormat(true);
System.out.println(hdf.formatParsha(jd));
jd.back();
System.out.println("Parsha on Friday [" + hdf.formatParsha(jd) + "]"); //no Parsha output on a non Shabbos
jd.setJewishDate(5773, JewishDate.TAMMUZ, 28); //double parsha
System.out.println(hdf.formatParsha(jd));

Output:

Tzav
צו
Parsha on Friday []
מטות מסעי

Rosh Chodesh

HebrewDateFormatter hdf = new HebrewDateFormatter();
JewishCalendar jd = new JewishCalendar(5773, JewishDate.NISSAN, 1);
if(jd.isRoshChodesh()){ //not necessary for formatter
	System.out.println(hdf.formatRoshChodesh(jd));
}
hdf.setHebrewFormat(true);
System.out.println(hdf.formatRoshChodesh(jd));
jd.forward();// roll calendar to second day of Nisan
System.out.println("output[" + hdf.formatRoshChodesh(jd) + "]"); //no output for Rosh Chodesh Formatting

Output:

Rosh Chodesh Nissan
ראש חודש ניסן
output[]

Daf Yomi

JewishCalendar jd = new JewishCalendar();
HebrewDateFormatter hdf = new HebrewDateFormatter();
System.out.println(hdf.format(jd)); //output current formatted date "13 Nissan, 5773"
Daf daf = jd.getDafYomiBavli(); //get the current daf
System.out.println(daf.getMasechtaTransliterated()); //outout transliterated masechta name "Eruvin"
System.out.println(daf.getDaf()); //output current daf (page) number "16"
System.out.println(hdf.formatDafYomiBavli(daf)); //outout the formatted date "Eruvin 16"
hdf.setHebrewFormat(true); //set formatted to Hebrew
System.out.println(hdf.format(jd)); //output date in Hebrew "י״ג ניסן תשע״ג"
System.out.println(daf.getMasechta()); // output masechta name in Hebrew "עירובין"
System.out.println(hdf.formatHebrewNumber(daf.getDaf()));//output the daf number formatted in Hebrew "ט״ז"
System.out.println(hdf.formatDafYomiBavli(daf)); //output daf and masechta in Hebrew "עירובין ט״ז"

Output:

13 Nissan, 5773
Eruvin
16
Eruvin 16
י״ג ניסן תשע״ג
עירובין
ט״ז
עירובין ט״ז

Chanukah

JewishCalendar jd = new JewishCalendar(5772, JewishDate.KISLEV, 25); //set date to first day of Chanukah
HebrewDateFormatter hdf = new HebrewDateFormatter();
System.out.println(jd);//output current transliterated date
System.out.println(jd.getDayOfChanukah()); //output #1
System.out.println(hdf.formatYomTov(jd)); //output Chanukah 1
hdf.setHebrewFormat(true); //set format to hebrew
System.out.println(hdf.formatHebrewNumber(jd.getDayOfChanukah())); //output 1 in Hebrew
System.out.println(hdf.formatYomTov(jd)); // output Chanukah 1 in hebrew

Output:

25 Kislev, 5772
1
Chanukah 1
א׳
א׳ חנוכה

Note, that there is no simple way at this point to output just Chanukah. This will likely change in the future to match Chanukah to the behavior of other Yomim Tovim.

Loop and output an entire year

JewishCalendar jc = new JewishCalendar(5773, JewishDate.TISHREI, 1);
jc.setInIsrael(false); //default false for clarity but not needed. Set to true for Israel
HebrewDateFormatter hdf = new HebrewDateFormatter();
hdf.setHebrewFormat(true);
HebrewDateFormatter hdfTransliterated = new HebrewDateFormatter();
String hebrewOutput = "";
String transliteratedOutput = "";
while(jc.getJewishYear() == 5773){
	hebrewOutput = hdf.format(jc);
	transliteratedOutput = hdfTransliterated.format(jc);
	if (jc.isYomTov() || jc.isTaanis()) {
		hebrewOutput += ", " + hdf.formatYomTov(jc);
		transliteratedOutput += ", " + hdfTransliterated.formatYomTov(jc);
	} else if(jc.getDayOfWeek() == 7){
		hebrewOutput += " - " + hdf.formatParsha(jc);
		transliteratedOutput += " - " + hdfTransliterated.formatParsha(jc);
	}
	if (jc.isChanukah()) {
		if (hebrewOutput.length() > 0) {
			hebrewOutput += ", ";
			transliteratedOutput += ", ";
		}
		hebrewOutput += hdf.formatYomTov(jc);
		transliteratedOutput  += hdfTransliterated.formatYomTov(jc);
	}
	if (jc.isRoshChodesh()) {
		if (hebrewOutput.length() > 0) {
			hebrewOutput += ", ";
			transliteratedOutput += ", ";
		}
		hebrewOutput += hdf.formatRoshChodesh(jc);
		transliteratedOutput += hdfTransliterated.formatRoshChodesh(jc);
	}
	if(jc.getDayOfOmer() > 0){
		hebrewOutput += ", ";
		transliteratedOutput += ", ";
		hebrewOutput += hdf.formatOmer(jc);
	}
	System.out.println(transliteratedOutput + " - " + hebrewOutput);
	jc.forward();
}

Output (most days removed for brevity):

1 Tishrei, 5773, Rosh Hashana - א׳ תשרי תשע״ג, ראש השנה
2 Tishrei, 5773, Rosh Hashana - ב׳ תשרי תשע״ג, ראש השנה
3 Tishrei, 5773, Fast of Gedalyah - ג׳ תשרי תשע״ג, צום גדליה
4 Tishrei, 5773 - ד׳ תשרי תשע״ג
...
6 Tishrei, 5773 - Vayeilech - ו׳ תשרי תשע״ג - וילך
...
10 Tishrei, 5773, Yom Kippur - י׳ תשרי תשע״ג, יום כיפור
...
15 Tishrei, 5773, Succos - ט״ו תשרי תשע״ג, סוכות
16 Tishrei, 5773, Succos - ט״ז תשרי תשע״ג, סוכות
17 Tishrei, 5773, Chol Hamoed Succos - י״ז תשרי תשע״ג, חול המועד סוכות
18 Tishrei, 5773, Chol Hamoed Succos - י״ח תשרי תשע״ג, חול המועד סוכות
19 Tishrei, 5773, Chol Hamoed Succos - י״ט תשרי תשע״ג, חול המועד סוכות
20 Tishrei, 5773, Chol Hamoed Succos - כ׳ תשרי תשע״ג, חול המועד סוכות
21 Tishrei, 5773, Hoshana Rabbah - כ״א תשרי תשע״ג, הושענא רבה
22 Tishrei, 5773, Shemini Atzeres - כ״ב תשרי תשע״ג, שמיני עצרת
23 Tishrei, 5773, Simchas Torah - כ״ג תשרי תשע״ג, שמחת תורה
...
30 Tishrei, 5773, Rosh Chodesh Cheshvan - ל׳ תשרי תשע״ג, ראש חודש חשוון
1 Cheshvan, 5773, Rosh Chodesh Cheshvan - א׳ חשוון תשע״ג, ראש חודש חשוון
...
25 Kislev, 5773, Chanukah 1 - כ״ה כסלו תשע״ג, א׳ חנוכה
26 Kislev, 5773, Chanukah 2 - כ״ו כסלו תשע״ג, ב׳ חנוכה
27 Kislev, 5773, Chanukah 3 - כ״ז כסלו תשע״ג, ג׳ חנוכה
28 Kislev, 5773, Chanukah 4 - כ״ח כסלו תשע״ג, ד׳ חנוכה
29 Kislev, 5773, Chanukah 5 - כ״ט כסלו תשע״ג, ה׳ חנוכה
1 Teves, 5773, Chanukah 6, Rosh Chodesh Teves - א׳ טבת תשע״ג, ו׳ חנוכה, ראש חודש טבת
2 Teves, 5773 - Miketz, Chanukah 7 - ב׳ טבת תשע״ג - מקץ, ז׳ חנוכה
3 Teves, 5773, Chanukah 8 - ג׳ טבת תשע״ג, ח׳ חנוכה
...
10 Teves, 5773, Tenth of Teves - י׳ טבת תשע״ג, עשרה בטבת
...
15 Shevat, 5773, Tu B'Shvat - ט״ו שבט תשע״ג, ט״ו בשבט
...
21 Shevat, 5773 - כ״א שבט תשע״ג
...
11 Adar, 5773, Fast of Esther - י״א אדר תשע״ג, תענית אסתר
...
14 Adar, 5773, Purim - י״ד אדר תשע״ג, פורים
15 Adar, 5773, Shushan Purim - ט״ו אדר תשע״ג, פורים שושן
...
27 Adar, 5773 - Vayakhel Pekudei - כ״ז אדר תשע״ג - ויקהל פקודי
...
15 Nissan, 5773, Pesach - ט״ו ניסן תשע״ג, פסח
16 Nissan, 5773, Pesach,  - ט״ז ניסן תשע״ג, פסח, א׳ בעומר
17 Nissan, 5773, Chol Hamoed Pesach,  - י״ז ניסן תשע״ג, חול המועד פסח, ב׳ בעומר
18 Nissan, 5773, Chol Hamoed Pesach,  - י״ח ניסן תשע״ג, חול המועד פסח, ג׳ בעומר
19 Nissan, 5773, Chol Hamoed Pesach,  - י״ט ניסן תשע״ג, חול המועד פסח, ד׳ בעומר
20 Nissan, 5773, Chol Hamoed Pesach,  - כ׳ ניסן תשע״ג, חול המועד פסח, ה׳ בעומר
21 Nissan, 5773, Pesach,  - כ״א ניסן תשע״ג, פסח, ו׳ בעומר
22 Nissan, 5773, Pesach,  - כ״ב ניסן תשע״ג, פסח, ז׳ בעומר
23 Nissan, 5773,  - כ״ג ניסן תשע״ג, ח׳ בעומר
...
26 Nissan, 5773 - Shmini,  - כ״ו ניסן תשע״ג - שמיני, י״א בעומר
...
6 Sivan, 5773, Shavuos - ו׳ סיוון תשע״ג, שבועות
7 Sivan, 5773, Shavuos - ז׳ סיוון תשע״ג, שבועות
...
17 Tammuz, 5773, Seventeenth of Tammuz - י״ז תמוז תשע״ג, שבעה עשר בתמוז
...
9 Av, 5773, Tishah B'Av - ט׳ אב תשע״ג, תשעה באב
...
15 Av, 5773, Tu B'Av - ט״ו אב תשע״ג, ט״ו באב
...