
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 shkiah, based on the opinion 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 use the API assuming that it is a fixed 4 minutes after sunset. The technique to calculate this with the API is the same as the way getTzais72Minutes() is calculated. The source of that method is
public Instant getTzais72Minutes() {
return getTimeOffset(getSunsetBasedOnElevationSetting(), Duration.ofMinutes(72));
}The getTimeOffset(Instant time, Duration offset) method in the base class AstronomicalCalendar is very simple:
public static Instant getTimeOffset(Instant time, Duration offset) {
if (time == null || offset == null) {
return null;
}
return time.plus(offset);
}The getTimeOffset method simply adds the offset to the time of the zman and returns the result. 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;
ZoneId timeZone = ZoneId.of("Asia/Jerusalem");
GeoLocation location = new GeoLocation(locationName, latitude, longitude, elevation, timeZone);
ZmanimCalendar zc = new ZmanimCalendar(location);
Instant baalHatanyaShkiah = AstronomicalCalendar.getTimeOffset(zc.getSeaLevelSunset(), Duration.ofMinutes(4));
System.out.println("Baal Hatanya Shkiah: " + baalHatanyaShkiah.atZone(timeZone));Adding it to the API itself would be even simpler:
public Instant getShkiahBaalHatanya() {
return getTimeOffset(getSeaLevelSunset(), Duration.ofMinutes(4));
}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 December 14, 2018 – ו׳ טבת תשע״ט: This article was superseded with the more recent and corrected article Baal Hatanya’s Zmanim Added to KosherJava Zmanim Library.




