Zmanim Project

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.

  1. Alos 120
  2. Alos 120 Zmanis
  3. Alos 26º
  4. Alos 96
  5. Alos 96 Zmanis
  6. Alos 19.8º
  7. Alos 90
  8. Alos 90 Zmanis
  9. Alos 19º
  10. Alos 18º
  11. Alos 16.1º
  12. Alos 72
  13. Alos 72 Zmanis
  14. Alos 60
  15. Alos Baal Hatanya
  16. Misheyakir 11.5º
  17. Misheyakir 11º
  18. Misheyakir 10.2º
  19. Misheyakir 9.5º
  20. Misheyakir 7.65º
  21. Sunrise
  22. Sea Level Sunrise
  23. Sof Zman Shma GRA
  24. Sof Zman Shma MGA 120
  25. Sof Zman Shma MGA 16.1º
  26. Sof Zman Shma MGA 18º
  27. Sof Zman Shma MGA 19.8º
  28. Sof Zman Shma MGA 72
  29. Sof Zman Shma MGA 72 Zmanis
  30. Sof Zman Shma MGA 90
  31. Sof Zman Shma MGA 90 Zmanis
  32. Sof Zman Shma MGA 96
  33. Sof Zman Shma MGA 96 Zmanis
  34. Sof Zman Shma MGA Alos to Sunset
  35. Sof Zman Shma MGA Alos to Tzais Geonim
  36. Sof Zman Shma 3 Hours Before Chatzos
  37. Sof Zman Shma 3 Hours Before Fixed Local Chatzos
  38. Sof Zman Shma Baal Hatanya/a>
  39. Sof Zman Shma Kol Eliyahu
  40. Sof Zman Shma Ateret Torah
  41. Sof Zman Tfila GRA
  42. Sof Zman Tfila MGA 120
  43. Sof Zman Tfila MGA 16.1º
  44. Sof Zman Tfila MGA 18º
  45. Sof Zman Tfila MGA 19.8º
  46. Sof Zman Tfila MGA 72
  47. Sof Zman Tfila MGA 72 Zmanis
  48. Sof Zman Tfila MGA 90
  49. Sof Zman Tfila MGA 90 Zmanis
  50. Sof Zman Tfila MGA 96
  51. Sof Zman Tfila MGA 96 Zmanis
  52. Sof Zman Tfila 2 Hours Before Chatzos
  53. Sof Zman Tfila 2 Hours Before Fixed Local Chatzos
  54. Sof Zman Tfila Baal Hatanya
  55. Sof Zman Tfila Ateret Torah
  56. Chatzos
  57. Fixed Local Chatzos
  58. Mincha Gedola GRA
  59. Mincha Gedola 30 Minutes
  60. Mincha Gedola 72
  61. Mincha Gedola 16.1º
  62. Mincha Gedola Ateret Torah
  63. Mincha Gedola Baal Hatanya
  64. Mincha Gedola Lechumra 30 Minutes
  65. Mincha Gedola Lechumra 30 Minutes Baal Hatanya
  66. Mincha Ketana GRA
  67. Mincha Ketana 16.1º
  68. Mincha Ketana 72
  69. Mincha Ketana Ateret Torah
  70. Mincha Ketana Baal Hatanya
  71. Plag GRA
  72. Plag 60
  73. Plag 72
  74. Plag 72 Zmanis
  75. Plag 90
  76. Plag 90 Zmanis
  77. Plag 96
  78. Plag 96 Zmanis
  79. Plag 120
  80. Plag 120 Zmanis
  81. Plag 16.1º
  82. Plag 18º
  83. Plag 19.8º
  84. Plag 26º
  85. Plag Alos to Sunset
  86. Plag Alos to Tzais Geonim
  87. Plag Ateret Torah
  88. Plag Baal Hatanya
  89. Candle Lighting
  90. Sea Level Sunset
  91. Sunset
  92. Bain Hashmashos Rabainu Tam 13.5 Minutes Before Tzais 7.083
  93. Bain Hashmashos Rabainu Tam 58.5 Minutes
  94. Bain Hashmashos Rabainu Tam 13.24º
  95. Bain Hashmashos Rabainu Tam 2 Stars
  96. Bain Hashmashos Yereim 18 Minutes
  97. Bain Hashmashos Yereim 3.05º
  98. Bain Hashmashos Yereim 16.875 Minutes
  99. Bain Hashmashos Yereim 2.8º
  100. Bain Hashmashos Yereim 13.5 Minutes
  101. Bain Hashmashos Yereim 2.1º
  102. Tzais Geonim 3.676º
  103. Tzais Geonim 3.65º
  104. Tzais Geonim 3.7º
  105. Tzais Geonim 3.8º
  106. Tzais Geonim 4.37º
  107. Tzais Geonim 4.61º
  108. Tzais Geonim 4.8º
  109. Tzais Geonim 5.88º
  110. Tzais Geonim 5.95º
  111. Tzais Geonim 6.45º
  112. Tzais Geonim 7.083º
  113. Tzais Geonim 7.67º
  114. Tzais Geonim 8.5º
  115. Tzais Geonim 9.3º
  116. Tzais Geonim 9.75º
  117. Tzais 72
  118. Tzais 72 Zmanis
  119. Tzais 16.1º
  120. Tzais 90
  121. Tzais 90 Zmanis
  122. Tzais 18º
  123. Tzais 19.8º
  124. Tzais 96
  125. Tzais 96 Zmanis
  126. Tzais 26º
  127. Tzais 120
  128. Tzais 120 Zmanis
  129. Tzais Ateret Torah
  130. Tzais Baal Hatanya
  131. Chatzos Halayla
  132. Shaah Zmanis 72 Minutes
  133. Shaah Zmanis 72 Minutes Zmanis
  134. Shaah Zmanis 16.1º
  135. Shaah Zmanis 90 Minutes
  136. Shaah Zmanis 90 Minutes Zmanis
  137. Shaah Zmanis 18º
  138. Shaah Zmanis 19.8º
  139. Shaah Zmanis 96 Minutes
  140. Shaah Zmanis 96 Zmanis
  141. Shaah Zmanis 26º
  142. Shaah Zmanis 120 Minutes
  143. Shaah Zmanis 120 Zmanis
  144. Shaah Zmanis Ateret Torah
  145. Shaah Zmanis Baal Hatanya
  146. Tchilas Zman Kidush Levana 3 Days
  147. Tchilas Zman Kidush Levana 7 Days
  148. Sof Zman Kidush Levana Between Moldos
  149. Sof Zman Kidush Levana 15 Days
  150. Sof Zman Achilas Chametz GRA
  151. Sof Zman Achilas Chametz MGA 72 Minutes
  152. Sof Zman Achilas Chametz MGA 16.1º
  153. Sof Zman Achilas Chametz Baal Hatanya
  154. Sof Zman Biur Chametz GRA
  155. Sof Zman Biur Chametz MGA 72 Minutes
  156. Sof Zman Biur Chametz MGA 16.1º
  157. Sof Zman Biur Chametz Baal Hatanya

32 thoughts on “Zmanim Project”

  1. 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

  2. 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.

  3. 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?

    1. 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.).

      1. 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.

  4. 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.

    1. Bernard,
      As far as the Zmanim Calendar,

      1. Maybe at some future date. Among other things, there are multiple way to transliterate them, and no one would be happy. See the documentation on the HebrewDateFormatter class to see some of the formatting options. The calendar code is in beta and likely to change dramatically, though I do not know when I will have time to do this.
      2. This is now done. I also added commas when multiple events happen in one day, so it now displays as “ויקרא, ראש חודש ניסן” and not “ויקרא ראש חודש ניסן
  5. 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.

    1. 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.

  6. 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.

  7. 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!

  8. 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!

    1. 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).

Leave a Reply

Your email address will not be published. Required fields are marked *