Until this point the KosherJava Zmanim API has been released under the GPL V2.0 open source license. This had the effect of forcing any application written using the library to release it’s source code under the same license. Being that the Zmanim API is a library, the LGPL is a more appropriate license. The LGPL allows developers to use the KosherJava Zmanim API, yet keep their application code closed source. Only changes to the API itself (such as ports to different languages) would have to be released as open source. I had in the past on request released the source under the LGPL (the Zmanim API .NET port has already been released under the LGPL with my permission), and with the recent 3/27/2011 SVN checkin I formally changed the Java Zmanim API license to the LGPL 2.1 (not the newer LGPL 3.0). The next 1.3.0 release will be the first formal release under the LGPL. In one case the change to the license required permission from developer who wrote code used by the Zmanim API, and this was done.
Category: Zmanim
Calculating Erev Pesach Zmanim
The Zmanim API did not have dedicated zmanim to claculate the Erev Pesach zmanim of sof zman achilas chametz (the latest time one can eat chametz), and sof zman biur chametz (the latest time to burn chametz) till the April 14 check in to the KosherJava Zmanim Project GitHub repository. The latest time for eating chametz is at the end of the 4th hour of the day. This corresponds to sof zman tfila. The API has about 12 of those, so that does not require any special programming, but to help developers who are unaware of how they work I created 3 wrapper getSofZmanAchilasChametz methods (getSofZmanAchilasChametzGRA(), getSofZmanAchilasChametzMGA72Minutes() and getSofZmanAchilasChametzMGA16Point1Degrees()) calling the 3 most commonly used getSofZmanTfila methods (getSofZmanTfilaGRA(), getSofZmanTfilaMGA72Minutes() and getSofZmanTfilaMGA16Point1Degrees()). For example here is the exact code used in getSofZmanAchilasChametzGRA()
public Date getSofZmanAchilasChametzGRA() { return getSofZmanTfilaGRA(); }
The API itself is very flexible, and as long as you know the calculation of the zman, you can easily calculate it. For example, to calculate sof zman biur chametz according to the GR"A, the time would be 5 shaos zmaniyos after sunrise. Using the Zmanim API this would be coded as:
Date SofZmanBiurChametzGra = getTimeOffset(getSeaLevelSunrise(), getShaahZmanisGra() * 5);
The exact code used in the API is:
public Date getSofZmanBiurChametzGRA() { return getTimeOffset(getSeaLevelSunrise(), getShaahZmanisGra() * 5); }
Developers who want to use the current API to generate these zmanim can use the following sample as a guide.
String locationName = "Lakewood, NJ"; double latitude = 40.09596; //Lakewood, NJ double longitude = -74.22213; //Lakewood, NJ double elevation = 0; //optional elevation TimeZone timeZone = TimeZone.getTimeZone("America/New_York"); GeoLocation location = new GeoLocation(locationName, latitude, longitude, elevation, timeZone); ComplexZmanimCalendar czc = new ComplexZmanimCalendar(location); czc.getCalendar().set(Calendar.YEAR, 2011); czc.getCalendar().set(Calendar.MONTH, Calendar.APRIL); czc.getCalendar().set(Calendar.DAY_OF_MONTH, 18); Date graAchilas = czc.getSofZmanTfilaGRA(); Date graBiur = czc.getTimeOffset(czc.getSeaLevelSunrise(), czc.getShaahZmanisGra() * 5); Date mga72Achilas = czc.getSofZmanTfilaMGA72Minutes(); Date mga72Biur = czc.getTimeOffset(czc.getAlos72(), czc.getShaahZmanisMGA() * 5); Date mga16Achilas = czc.getSofZmanTfilaMGA16Point1Degrees(); Date mga16Biur = czc.getTimeOffset(czc.getAlos16Point1Degrees(), czc.getShaahZmanis16Point1Degrees() * 5); System.out.println("Erev Pesach Zmanim for " + locationName); System.out.println("Sof Zman Achilas Chametz GRA: " + graAchilas); System.out.println("Sof Zman Biur Chametz GRA: : " + graBiur); System.out.println("Sof Zman Achilas Chametz MGA 72 Minutes: " + mga72Achilas); System.out.println("Sof Zman Biur Chametz MGA 72 Minutes: " + mga72Biur); System.out.println("Sof Zman Achilas Chametz MGA 16.1 Deg: " + mga16Achilas); System.out.println("Sof Zman Biur Chametz MGA 16.1 Deg: " + mga16Biur);
this would output
C:\path\to\code>javac ErevPesachZmanim.java C:\path\to\code>java ErevPesachZmanim Erev Pesach Zmanim for Lakewood, NJ Sof Zman Achilas Chametz GRA: Mon Apr 18 10:42:42 EDT 2011 Sof Zman Biur Chametz GRA: : Mon Apr 18 11:49:39 EDT 2011 Sof Zman Achilas Chametz MGA 72 Minutes: Mon Apr 18 10:18:42 EDT 2011 Sof Zman Biur Chametz MGA 72 Minutes: Mon Apr 18 11:37:39 EDT 2011 Sof Zman Achilas Chametz MGA 16.1 Deg: Mon Apr 18 10:13:56 EDT 2011 Sof Zman Biur Chametz MGA 16.1 Deg: Mon Apr 18 11:35:18 EDT 2011
Zmanim API Now in a Public SVN Server
Thanks to Jay Gindin, the Zmanim API source code is now in a publicly available SVN server. The Google Code project can be found at code.google.com/p/kosherjava. This will have a number of benefits to the project. It will more easily allow users to find the code, ensure that they have the latest code, track changes, and allow reverting to prior versions in case an issue arises with newly checked in code. It will also allow me to stop the manual backups (part of the projects Ant build script) done as part of every development build. The repository has the new hebrewcalendar package mentioned in the recently posted FAQ: How do I Calculate the Jewish/Hebrew Date for …?. This new code is under heavy revision, and there will be changes that will likely break code using the current alpha version. The pace of changes to the interface will likely remain stable once the first beta version is released (probably after Pesach). The next step will be to touch base with various people who have copies of the API in their own SVN to either update or link to this official project SVN server.
KosherJava Zmanim Code Now in GitHub
With Google shutting down Google Code at the end of 2015, the KosherJava Zmanim source code has been moved to GitHub.
FAQ: How do I Calculate the Jewish/Hebrew Date for …?
This FAQ is now obsolete. Jewish Calendar Calculations are now supported. See the Zmanim API 1.3.0 Release announcement
Question:
How do I get the Jewish Date for … using the Zmanim API?
Answer:
The current version of the Zanim API does not support Jewish calendrical calculations. Zmanim are almost exclusively based on the solar calendar, so for example, the sunrise on February 8th this year in Montreal (or any other date and location), will be almost the same every year. for this reason there was little point (as far as zmanim) to support Jewish date calculations in the API. One of the only zmanim to rely on a Jewish date is the sof zman kidush levanah calculation, though there are some opinions that it is purely molad based, and this can be calculated without a Jewish calendar component to the API. This zman is obviously not currently implemented in the Zmanim API. I am currently working on adding Jewish date support to the API. The code is based off Avrom Finkelstein‘s no longer active HebrewDate project. I refactored a lot of the code and fixed a number of bugs. Anyone interested in alpha testing this code can download the latest Zmanim SVN code.
I mentioned that it “will be almost the same every year” and this is due the approximate 1/4 day drift between the 356 day calendar year and the approximately 365.25 days actually present in the astronomical year, a discrepancy corrected every leap year. A future FAQ (probably a few of them) may delve specifically into this drift as well as general zmanim accuracy issues in detail.
If you are simply looking to convert a Hebrew date to Gregorian or Gregorian to Hebrew online without the API, try the JewishGen calendar conversion tools.
Davening Direction from Alaska
As mentioned briefly in the “Why Some Zmanim Never Occur” post, the Lubavitch Jewish Center of Anchorage, Alaska has an interesting davening (prayer) direction question. As explained in the “Bearing to Yerushalayim and Zmanim Map” (additional technical information is available in the “Technical Information about the Bearing to Yerushalayim Map” post), there are two opinions about the proper direction to face during Tfilah (prayers). The Levush and others are of the opinion that one should face the rhumb line direction to Yerushalayim, while the Emunas Chachamim and others are of the opinion that one should face the initial bearing of the great circle route. Both of these opinions would clearly use the shortest rhumb or great circle lines to Yerushalayim. As an example, a person standing on Har Hazaisim (Mount of Olives) a mile east of Har Habayis would not daven east using the logic that continuing east for approximately 21,175 miles[1] would reach Yerushalayim via global circumnavigation, when Har Habayis is just one mile to the west. The shul in Anchorage is located at a longitude of -149.861°. The antipode of Har Habayis is on the -144.764851 longitude line – 180° of longitude from Har Habayis. People on different sides of this line (this line is also the halachic dateline according to Rav Yechiel Michel Tucazinsky and others) will daven in opposite directions. The Anchorage shul with a longitude of -149.861° is 169.69 miles (273.1 km) west of the -144.764851° longitude line[2]. For this reason, the shul should daven not east, but west (255.78° from the north, or slightly south-west) if using the common rhumb line calculation, or north (355.67° from the north, or slightly west of north) if using the great circle calculation. Alaska is the only location in the world that has the -144.764851° longitude line cut across dry land, and is therefore the only non-ocean location to face this issue.
Notes:
1. Based on a rhumb line along the 31° 50′ circle of latitude as opposed to 24,901 miles at the equator) using a WGS84 Reference ellipsoid.
2. Rhumb line calculation as calculated by Movable Type using the same latitude for both points. The ellipsoidal shape of the earth is factored into this calculation. The short distance means that the 169.66 mi (272.98 km) great circle distance is very close to the rhumb line distance.