The Zmanim (“times” referring to the calculations of time that govern the start and end time of Jewish prayers and holidays) project is a Java API for generating zmanim from within Java programs. The Java Zmanim API has been ported to .NET (Jewish Zmanim Framework) and Objective-C (KosherCocoa). If you are a non programmer, this means that the software created by the project is a building block of code to allow other programmers to easily include zmanim in their programs. The basis for most zmanim in this class are from the sefer Yisroel Vehazmanim by Rabbi Yisroel Dovid Harfenes. The code available under the LGPL license can now be downloaded from the KosherJava Zmanim code repository. Older stable releases can be downloaded from the download page.
Please note: due to atmospheric conditions (pressure, humidity and other conditions), calculating zmanim accurately is very complex. The calculation of zmanim is dependent on Atmospheric refraction (refraction of sunlight through the atmosphere), and zmanim can be off by up to 2 minutes based on atmospheric conditions. Inaccuracy is increased by elevation. It is not the intent of this API to provide any guarantee of accuracy. See Using a Digital Terrain Model to Calculate Visual Sunrise and Sunset Times for additional information on the subject.
How to Use the API
Information on how to use the API can be found on the How to Use the API page as well as by reading the JavaDocs
Zmanim Calendar Generator
A sample use of the API can be seen in the calendar generator. This uses the Zmanim API to generate an annual Zmanim calendar in an Excel spreadsheet. Since this is a demo of the API, the calendar is generated using All (about 102 currently) possible zmanim that the API can generate.
List of Zmanim Supported by the API
The API currently can generate about 157 different zmanim. Explanation of most of these can be seen by browsing the JavaDocs. You can link to the documentation of the specific zmanim from the links below.
- Alos 120
- Alos 120 Zmanis
- Alos 26º
- Alos 96
- Alos 96 Zmanis
- Alos 19.8º
- Alos 90
- Alos 90 Zmanis
- Alos 19º
- Alos 18º
- Alos 16.1º
- Alos 72
- Alos 72 Zmanis
- Alos 60
- Alos Baal Hatanya
- Misheyakir 11.5º
- Misheyakir 11º
- Misheyakir 10.2º
- Misheyakir 9.5º
- Misheyakir 7.65º
- Sunrise
- Sea Level Sunrise
- Sof Zman Shma GRA
- Sof Zman Shma MGA 120
- Sof Zman Shma MGA 16.1º
- Sof Zman Shma MGA 18º
- Sof Zman Shma MGA 19.8º
- Sof Zman Shma MGA 72
- Sof Zman Shma MGA 72 Zmanis
- Sof Zman Shma MGA 90
- Sof Zman Shma MGA 90 Zmanis
- Sof Zman Shma MGA 96
- Sof Zman Shma MGA 96 Zmanis
- Sof Zman Shma MGA Alos to Sunset
- Sof Zman Shma MGA Alos to Tzais Geonim
- Sof Zman Shma 3 Hours Before Chatzos
- Sof Zman Shma 3 Hours Before Fixed Local Chatzos
- Sof Zman Shma Baal Hatanya/a>
Sof Zman Shma Kol Eliyahu- Sof Zman Shma Ateret Torah
- Sof Zman Tfila GRA
- Sof Zman Tfila MGA 120
- Sof Zman Tfila MGA 16.1º
- Sof Zman Tfila MGA 18º
- Sof Zman Tfila MGA 19.8º
- Sof Zman Tfila MGA 72
- Sof Zman Tfila MGA 72 Zmanis
- Sof Zman Tfila MGA 90
- Sof Zman Tfila MGA 90 Zmanis
- Sof Zman Tfila MGA 96
- Sof Zman Tfila MGA 96 Zmanis
- Sof Zman Tfila 2 Hours Before Chatzos
- Sof Zman Tfila 2 Hours Before Fixed Local Chatzos
- Sof Zman Tfila Baal Hatanya
- Sof Zman Tfila Ateret Torah
- Chatzos
- Fixed Local Chatzos
- Mincha Gedola GRA
- Mincha Gedola 30 Minutes
- Mincha Gedola 72
- Mincha Gedola 16.1º
- Mincha Gedola Ateret Torah
- Mincha Gedola Baal Hatanya
- Mincha Gedola Lechumra 30 Minutes
- Mincha Gedola Lechumra 30 Minutes Baal Hatanya
- Mincha Ketana GRA
- Mincha Ketana 16.1º
- Mincha Ketana 72
- Mincha Ketana Ateret Torah
- Mincha Ketana Baal Hatanya
- Plag GRA
- Plag 60
- Plag 72
- Plag 72 Zmanis
- Plag 90
- Plag 90 Zmanis
- Plag 96
- Plag 96 Zmanis
- Plag 120
- Plag 120 Zmanis
- Plag 16.1º
- Plag 18º
- Plag 19.8º
- Plag 26º
- Plag Alos to Sunset
- Plag Alos to Tzais Geonim
- Plag Ateret Torah
- Plag Baal Hatanya
- Candle Lighting
- Sea Level Sunset
- Sunset
- Bain Hashmashos Rabainu Tam 13.5 Minutes Before Tzais 7.083
- Bain Hashmashos Rabainu Tam 58.5 Minutes
- Bain Hashmashos Rabainu Tam 13.24º
- Bain Hashmashos Rabainu Tam 2 Stars
- Bain Hashmashos Yereim 18 Minutes
- Bain Hashmashos Yereim 3.05º
- Bain Hashmashos Yereim 16.875 Minutes
- Bain Hashmashos Yereim 2.8º
- Bain Hashmashos Yereim 13.5 Minutes
- Bain Hashmashos Yereim 2.1º
- Tzais Geonim 3.676º
- Tzais Geonim 3.65º
- Tzais Geonim 3.7º
- Tzais Geonim 3.8º
- Tzais Geonim 4.37º
- Tzais Geonim 4.61º
- Tzais Geonim 4.8º
- Tzais Geonim 5.88º
- Tzais Geonim 5.95º
- Tzais Geonim 6.45º
- Tzais Geonim 7.083º
- Tzais Geonim 7.67º
- Tzais Geonim 8.5º
- Tzais Geonim 9.3º
- Tzais Geonim 9.75º
- Tzais 72
- Tzais 72 Zmanis
- Tzais 16.1º
- Tzais 90
- Tzais 90 Zmanis
- Tzais 18º
- Tzais 19.8º
- Tzais 96
- Tzais 96 Zmanis
- Tzais 26º
- Tzais 120
- Tzais 120 Zmanis
- Tzais Ateret Torah
- Tzais Baal Hatanya
- Chatzos Halayla
- Shaah Zmanis 72 Minutes
- Shaah Zmanis 72 Minutes Zmanis
- Shaah Zmanis 16.1º
- Shaah Zmanis 90 Minutes
- Shaah Zmanis 90 Minutes Zmanis
- Shaah Zmanis 18º
- Shaah Zmanis 19.8º
- Shaah Zmanis 96 Minutes
- Shaah Zmanis 96 Zmanis
- Shaah Zmanis 26º
- Shaah Zmanis 120 Minutes
- Shaah Zmanis 120 Zmanis
- Shaah Zmanis Ateret Torah
- Shaah Zmanis Baal Hatanya
- Tchilas Zman Kidush Levana 3 Days
- Tchilas Zman Kidush Levana 7 Days
- Sof Zman Kidush Levana Between Moldos
- Sof Zman Kidush Levana 15 Days
- Sof Zman Achilas Chametz GRA
- Sof Zman Achilas Chametz MGA 72 Minutes
- Sof Zman Achilas Chametz MGA 16.1º
- Sof Zman Achilas Chametz Baal Hatanya
- Sof Zman Biur Chametz GRA
- Sof Zman Biur Chametz MGA 72 Minutes
- Sof Zman Biur Chametz MGA 16.1º
- Sof Zman Biur Chametz Baal Hatanya
Shalom,
I am curious if you’re aware of or compared your calculations to those used in kaluach. (www.kaluach.org). Yisroel also publishes some APIs via his site.
I am not asking out of idle curiosity but have an interest in knowing whether there are differences. I am not sure what offsets he uses for refraction nor which sunrise sunset calculation he uses. I know that he currently uses 0 elevation.
Shabbat Shalom,
(Rabbi) Shmuel Weisberg
Rabbi Weisberg,
I just took a look at the Kaluach JavaScript code (the Windows API is in a DLL/COM object without the sourcecode available to me). From the Javascript source it is clear that the code is based on the USNO algorithm. The offset to the 90° below the zenith used by their code for sunrise/set uses a combined 50′ (minutes of a degree = 50/60 or .83333) for refraction and solar radius. This is pretty much the standard used, where the solar radius is 16′ and the refraction average is 34′. They use the following offsets for zmanim.
Alos: 106°
Misheyakir: 101°
Tzais: 96°
Please let me know if you have any additional questions, though you are probably better off asking them.
Our shul is interested in featuring a display which among other things displays the countdown to the end of certain zmanim, such as
Countdown latest lime for:
Shema, Amida, Birkat Halevana, etc.
Since our shul has a great many late minyanim in the morning and continuous minyanim for Minha/Arvit, there is a great need for the people to know when these times occur.
We anticipate using LCD screens connected to a PC which will run the countdown clock among other messages (reminders for yaaleh v’yavo, hamelech hakadosh, etc.
Would you know anyone who would be able to help us with the programming of such an app?
Hey Jack, I don’t know if you have anything yet, but feel free to contact me. I may know of something.
😉
Moshe,
Can you please contact me about the same item?
We would like to get a Luach that has the Zmanim and “Davening Info” on it.
Thanks….
Jerry
ffjerry AT gmail . c o m
hi moshe im also looking for somthing like that how can i get in touch with you?
Were there any efforts to port KosherJava API to C++?
Thanks.
Bahaltener,
while porting should not be complex, I am unaware of effort to port it to C++ at the moment. The only complex part would be the portions of the code that use the Java Timezone and GergorianCalendar classes.
It would be interesting to port it to C++. I’ll take a look at the code. boost date_time API: https://www.boost.org/doc/libs/1_41_0/doc/html/date_time.html provides a useful set of calendar operations. May be it can be utilized to cover what KosherJava is using from Timezone and GregorianCalendar classes.
You may want to touch base with Moshe Wagner who used the Java Zmanim API in the Qt C++ based Luach. I posted details in the ZmanimCLI (Command Line Interface) post. Though he did not do a direct port, he would likely be interested. I would be happy to host any port.
On a side note. Why did you use GPL specifically for your API? Since it is a library, would it be better to release it under LGPL or other more permissive license?
For example, let’s say there is a port of KosherJava to other language. I assume, since the original is under GPL (2 or higher) the port will be also under GPL2(+). GPL library can only be used in GPL (or compatible) licensed code I believe. Therefore not only closed source projects, but even open source ones which use GPL incompatible licenses (let’s say MPL, CDDL, EPL, etc.) will not be able to be linked with the library. (That’s why in general, libraries are released under more permissive licenses, like LGPL, FreeBSD, X11 etc.).
Any thoughts on licensing?
Sorry for the delay in responding. There are two reasons that the code was released under the GPL and not the LGPL. The first one is that the oldest calculation engine used by the API, the
ZmanimCalculator class(no longer available), my modification of Ken Bloom’s code was released by him under the GPL. At this point, since I have another class, the SunTimesCalculator that returns the identical output and is not restricted to the GPL, this is no longer an issue, as long as this class is not included. The second one is that ideally, I would like people to release the entire app source, and thus the GPL, but I have as the code owner made some exceptions and in a few cases released the API to some developers under a non-transferable LGPL license. I would certainly allow the release of the C++ port to be released under the LGPL, and will consider a license change to the LGPL for the Java API in the future.A sheynem dank!
I’ll start porting KosherJava API to C++ sometime soon I hope.
Any updates?
Montreal canada why its says dawn 00:46? And all the zmanim are too early?
Shaul,
Thanks for contacting me. Are you using the API to generate these zmanim? Have a look at the Zmanim Map for Montreal where you will see accurate zmanim. If you are using the API, please share your code with me via the contact page so that I can try to help you debug it.
Hi, i’m traveling from Ben Gurion to Toronto on Motzei Shabbos/Sunday morning, as I can’t find an in-flight zmanim calculator. Can anyone help me with this?
Raphi,
Have a look at the Chai Tables. Click on the “Online Tables…” link. The front page of this site links to the Chai Tables.
Htzlacha.
The Zmanim calendar that is available for download is very useful, but I would like to request some modifications:
1. Please show the Hebrew date and Chaggim in English characters
2. Please include fast days as a “Chag”. There are some complications that a fast cannot start on a Saturday night, so it would be helpful if the system made this calculation as part of its output.
Bernard,
As far as the Zmanim Calendar,
Hello there!
I’m currently trying to implement Zmaney Hayom code for PHP.
PHP has a built-in sunrise and sunset functions. However, they require zenith (it has a built-in zenith as-well which is 90+(50/60)) which I don’t really know how to use it when I want the sun to be above the horizon or blow the horizon.
Could you explain me please how do I convert the degrees above/below the horizon into zenith value?
I would like to know which zmanim I should use if I’ “supporting” Gra and which I should use if I’m “supporting” MGA (Couldn’t find any other word except of “supporting”), so If you can tell me that, I will be gatefull.
Kfir,
As far as zenith, have a look at my source for the 16.1 zenith. the 90.8333 includes solar radius and refraction added to the true 90° zenith. For anything below the horizon do not add the 5/6 (0.833) to the zenith, but add 16.1 to the 90 zenith. My API does not calculate solar position above the horizon, but uses shaos zmaniyos calculations (dividing the day into 12, and using 3 hours for sof zman krias shema for example). I would suggest that you have a look at Misha Beshkin’s WordPress Zmanim Widget to see how he implemented the zmanim in PHP.
Thank you very much for your zmanim calendar generator- I find it very helpful. It is really a great service to the community.
I would like to request a couple of more zmanim to be added as options. Rabbi Heineman of the star-k holds that misheyakir is 7 degrees below the horizon. (See When Does One Pray When There Is No Day) as this zman seems to comport best with the m’tzius, I try to be choshesh for it. I would love if you could add that in.
The other zman I would love to see would be tzeis hakochavim at 6.45 degrees. This is about where Rav Tucashinsky used for fasts other than Yom Kippur, and according to a Rav I spoke to is the time a moch dachuk must be kept it as well as the earliest time a baby born on Friday night can get a bris on Shabbos. it arguably also would follow that that time should be used according to them for calculating the half hour before tzeis when a meal cannot be started. I therefore would love if you could add in this zman.
I would really appreciate if you could add these zmanim to the calendar since unfortunately I do not know how to program.
Thank you so much for help!
With much appreciation,
Nesanel
Thank you
P.S. I tried emailing you using the comment form but I got a delivery failure notice from Yahoo.
Sof zman for eating and buring chametz need to fixed according to all shitos.
Can you provide more details about what you are looking for? What do you feel is missing? Keep in mind that this is an API and can be used to generate any zmanim you may want.
Hi KosherJava,
First of all, thanks for your work making Zmanim accessible to all. Great work!
I’m working now on my own zmanim via PHP.
I have some questions which i hope you can help me with.
I’m using the function date_sunset() / date_sunset() in order to get sunrise and sunset times.
first question: I’m not sure which zenith i should send to the function.
Is it: A. 90 + (50/60) OR B. 90 + .58333
When I compare my results (testing both options) to other zmanim websites from different sources. My sunrise/sunset times are inaccurate at a range of 0-3 .
I think option B (90 + .58333) is more closer to them (but I guess I should consider the difference in location as well.. because it seems that our Latitude/Longitude coordinate are not perfectly equal).
Which option would you choose?
Second question: Is it ok to choose 90+(50/60) for sunrise and 90 + .58333 for sunset? or should I use the same exact zenith to calculate both sunrise and sunset?
Third question: Do I have to add this variable (50/60) / .58333 in order to calculate other times (that are not the exact sunrise/sunset)? calculation like:
Alos (16.1 Below Horizon)? A. 90 + 16.1 OR B. 90+(50/60) + 16.1
Tallit (11 Below Horizon)? A. 90 + 11 OR B. 90+(50/60) + 11
End of Shabbat (8.5 Below Horizon)? A. 90 + 8.5 OR B. 90+(50/60) + 8.5.
What do you think? Which option would you choose?
I would appreciate any help on this issues!
Regarding my earlier questions. I made some testing and compared them with NOAA Solar Calculations and I founded the following:
1. 90 + .58333 is the better option. ( I compared it with NOAA Solar Calculations using the exact location parameters).
2. I guess not..
3. No.
Now i have another question:
How do I calculate Chatzos Halayla (Jewish midnight)?
Thanks!
Will you or anybody else be interested in implementing a Hebrew Chronology for java?
can someone guide me how to create a plugin for google earth or equivalent that will caculate the distance in amos according to all shitos for a tchum map?
I have had a few requests from my app’s users for “הנץ החמה הנראה“.
Which function(s) should I use?
Moshe,
Sadly this is very complex and requires details digital terrain maps and is not something that can be added now. Even if you had access to the data, a very large number of calculations would have to be done, something that can’t be done on the fly on a mobile app. A calendar that was pre-generated can take an hour or 2 (while pulling the map data from an online source) without anyone caring, but try to make your user wait 2 minutes to calculate hanetz hanireh… See HeyWhatsThat to see what is involved (they are not doing it for zmanim, but it gives you an idea).