The Zmanim API version 1.3.0 was released on March 4th, 2013 כ״א אדר תשע״ג. Various changes in the new release VS the previous version 1.2.1 that was released in May 2010 can be seen below. This release includes beta support for Jewish Calendar calculations as well as a number of updated zmanim and refactored code. The Jewish Calendar support in the Zmanim API is based on Avrom Finkelstien’s HebrewDate project released in 2002. Unlike the Zmanim code, the Jewish calendar interfaces may change significantly in the future (see Jay Gindin’s various changes that may make it into this API) and should therefore be considered beta.
Changes in the Zmanim API 1.3.0 release
Changes since March 23, 2011 have been in SVN and detailed changes can be seen there.
In the past I posted about Android Zmanim, Jay Gindin’s open source Android zmanim project that uses the KosherJava Zmanim API. The fact that Android development uses Java natively means that it is very simple for Android developers to include zmanim in their apps. Since that time there have been a number of other applications (including iPhone apps) using the code. Moshe’s KosherCocoa Obj-C port of the KosherJava Zmanim API will probably result in additional iPhone apps that use the API. Yitzchok’s older Zmanim .NET port of the KosherJava Zmanim API also opened the door for Windows Phone zmanim applications as well (Ari Polski’s Zmaim app already uses it, and there are others in the works). I may post additional details about some of them in the future, including an updated post about Jay’s latest Android Zmanim release. I am aware of the following mobile applications that use the KosherJava Zmanim API.
There are also a few secular apps that are non-zmanim specific that use the API for sunrise and sunset calculations. One that I know of is Jeffrey Blattman’s Dawn to Dusk Widget, and I know that there are some photography apps that use it for sunrise/set calculations as well. There are likely more that I have missed, and a few that are in active development but unreleased. If you are aware of any missed apps, please let me know.
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 the Zmanim API, and this was done.
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.
The Zmanim API 1.2.1 was released today. Changed in this release were the addition of a few very early Tzais zmanim, and the removal of references to the GregorianCalendar in favor of the base Calendar class to ease Noah Blumenthal’s use of the Zmanim API in a zmanim application for the BlackBerry. This change has no impact on functionality as tested using Yitzchok’s new JUnit tests. Additionally, the JavaDoc Zmanim API documentation was modified to clearly indicate that zmanim can return nulls. A followup post will have details on this.
The main download is the Zmanim 1.2.1 release zip file that includes source files and JavaDoc documentation. Also available for download (included in the above zip file) is the main zmanim-1.2.1.jar and the zmanimAstronomical-1.2.1.jar that only includes the AstronomicalCalendar. The removal of the GregorianCalendar was in this class. Additional detail on the downloads can be seen on the Zmanim Download page
Yitzchok ported the Zmanim API from Java to a .NET API using C#. The Zmanim .NET project was released under the LGPL. This is a change from the GPL used by the Java API, something that may change shortly. Also part of the project was the creation of a C# version of the Zmanim CLI, matching Moshe Wagner’s Java Zmanim CLI. When developing the project, Yitzchok created the ZmanimTest JUnit test case class to confirm that the C# port output matched the Java API. I will likely add this to the core Zmanim API in the near future. The port currently relies on IKVM assemblies as can be seen in the Java references in the code sample below, mostly because of the lack of a native .NET equivalent of the Java TimeZone class. Yitzchok also created some examples of the use of the Zmanim .NET API that will be of help to developers. Below are two of the simpler examples in C# and VB.NET demonstrating a very simple use of the API to output zmanim from the console.
using Zmanim.TzDatebase; //in Zmanim.TzDatebase.dll assembly
static void Main(string args)
string locationName = "Lakewood, NJ";
double latitude = 40.09596; //Lakewood, NJ
double longitude = -74.22213; //Lakewood, NJ
double elevation = 0; //optional elevation
ITimeZone timeZone = new OlsonTimeZone("America/New_York");
GeoLocation location = new GeoLocation(locationName, latitude, longitude, elevation, timeZone);
ComplexZmanimCalendar zc = new ComplexZmanimCalendar(location);
//optionally set it to a specific date with a year, month and day
//ComplexZmanimCalendar zc = new ComplexZmanimCalendar(new DateTime(1969, 2, 8), location);
System.Console.WriteLine("Today's Zmanim for " + locationName);
System.Console.WriteLine("Sunrise: " + zc.GetSunrise()); //output sunrise
System.Console.WriteLine("Sof Zman Shema MGA: " + zc.GetSofZmanShmaMGA()); //output Sof Zman Shema MGA
System.Console.WriteLine("Sof Zman Shema GRA: " + zc.GetSofZmanShmaGRA()); //output Sof Zman Shema GRA
System.Console.WriteLine("Sunset: " + zc.GetSunset()); //output sunset
System.Console.WriteLine("Press enter to exit.");
mports Zmanim.TzDatebase 'in Zmanim.TzDatebase.dll assembly
Dim locationName As String = "Lakewood, NJ"
Dim latitude As Double = 40.09596 'Lakewood, NJ
Dim longitude As Double = -74.22213 'Lakewood, NJ
Dim elevation As Double = 0 'optional elevation
Dim timeZone As ITimeZone = New OlsonTimeZone("America/New_York")
Dim location As New GeoLocation(locationName, latitude, longitude, elevation, timeZone)
Dim zc As New ComplexZmanimCalendar(location)
'optionally set it to a specific date with a year, month and day
'Dim zc As New ComplexZmanimCalendar(New DateTime(1969, 2, 8), location)
System.Console.WriteLine("Today's Zmanim for " & locationName)
System.Console.WriteLine("Sunrise: " & zc.GetSunrise().ToString)
System.Console.WriteLine("Sof Zman Shema MGA: " & zc.GetSofZmanShmaMGA().ToString)
'output Sof Zman Shema MGA
System.Console.WriteLine("Sof Zman Shema GRA: " & zc.GetSofZmanShmaGRA().ToString)
'output Sof Zman Shema GRA
System.Console.WriteLine("Sunset: " & zc.GetSunset().ToString)
System.Console.WriteLine("Press enter to exit.")
The current Zmanim .NET TODO list for the project includes:
- Remove dependency to Java (IKVM assemblies)
- The API should follow the .NET guidelines
- Make it Linq friendly
- Add examples how to use this project in a ASP.NET MVC site and WPF Application
- Try to get it to work on Silverlight
There are various software projects using the KosherJava Zmanim API. One of the active ones is Jay Gindin’s open source Android Zmanim app for the Android platform. Activity in the project is constant. The upcoming version allows the selection of a specific calculation for zmanim you want such as the zman Talis/Tefilin pictured here. There are plans to add direction to Yerushalayim functionality using the Zmanim API. (For more information on calculating bearing using the API, see Calculating the Bearing/Direction to Har Habayis Using the Zmanim API article.) A large part of Jay’s motivations for developing the code was lezecher nishmas his nephew Shemuel Reuven ben Yehudit Rachel who, lost his battle with cancer on October 21, 2009. The one very minor issue Jay had with the API (and documentation) was the Ashkenazi spelling of the zmanim names, something that as an Ashekenazi I do not plan to change :), but as you can see his Android Zmanim front end used Sephardi labeling. Asked how he found the project, he answered with the typical answer to this question
I Googled around, and found your project.
One of my goals with the API was to make it easy for developers to use and port. This was confirmed by Jay
I found it to be very easy to pull into my app, even on Android…no changes necessary, not even a recompile