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 dependant 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 122 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 18º
  10. Alos 16.1º
  11. Alos 72
  12. Alos 72 Zmanis
  13. Alos 60
  14. Misheyakir 10.2º
  15. Misheyakir 11º
  16. Misheyakir 11.5º
  17. Sunrise
  18. Sea Level Sunrise
  19. Sof Zman Shma GRA
  20. Sof Zman Shma MGA 120
  21. Sof Zman Shma MGA 16.1º
  22. Sof Zman Shma MGA 18º
  23. Sof Zman Shma MGA 19.8º
  24. Sof Zman Shma MGA 72
  25. Sof Zman Shma MGA 72 Zmanis
  26. Sof Zman Shma MGA 90
  27. Sof Zman Shma MGA 90 Zmanis
  28. Sof Zman Shma MGA 96
  29. Sof Zman Shma MGA 96 Zmanis
  30. Sof Zman Shma MGA Alos to Sunset
  31. Sof Zman Shma MGA Alos to Tzais Geonim
  32. Sof Zman Shma 3 Hours Before Chatzos
  33. Sof Zman Shma 3 Hours Before Fixed Local Chatzos
  34. Sof Zman Shma Kol Eliyahu
  35. Sof Zman Shma Ateret Torah
  36. Sof Zman Tfila GRA
  37. Sof Zman Tfila MGA 120
  38. Sof Zman Tfila MGA 16.1º
  39. Sof Zman Tfila MGA 18º
  40. Sof Zman Tfila MGA 19.8º
  41. Sof Zman Tfila MGA 72
  42. Sof Zman Tfila MGA 72 Zmanis
  43. Sof Zman Tfila MGA 90
  44. Sof Zman Tfila MGA 90 Zmanis
  45. Sof Zman Tfila MGA 96
  46. Sof Zman Tfila MGA 96 Zmanis
  47. Sof Zman Tfila 2 Hours Before Chatzos
  48. Sof Zman Tfila 2 Hours Before Fixed Local Chatzos
  49. Sof Zman Tfila Ateret Torah
  50. Chatzos
  51. Fixed Local Chatzos
  52. Mincha Gedola GRA
  53. Mincha Gedola 72
  54. Mincha Gedola 16.1º
  55. Mincha Gedola Ateret Torah
  56. Mincha Gedola Lechumra 30 Minutes
  57. Mincha Ketana GRA
  58. Mincha Ketana 16.1º
  59. Mincha Ketana 72
  60. Mincha Ketana Ateret Torah
  61. Plag GRA
  62. Plag 60
  63. Plag 72
  64. Plag 72 Zmanis
  65. Plag 90
  66. Plag 90 Zmanis
  67. Plag 96
  68. Plag 96 Zmanis
  69. Plag 120
  70. Plag 120 Zmanis
  71. Plag 16.1º
  72. Plag 18º
  73. Plag 19.8º
  74. Plag 26º
  75. Plag Alos to Sunset
  76. Plag Alos to Tzais Geonim
  77. Plag Ateret Torah
  78. Candle Lighting
  79. Sea Level Sunset
  80. Sunset
  81. Bain Hashmashos Rabainu Tam 13.5 Minutes Before Tzais 7.083
  82. Bain Hashmashos Rabainu Tam 58.5 Minutes
  83. Bain Hashmashos Rabainu Tam 13.24º
  84. Bain Hashmashos Rabainu Tam 2 Stars
  85. Tzais Geonim 3.65º
  86. Tzais Geonim 4.37º
  87. Tzais Geonim 4.61º
  88. Tzais Geonim 4.8º
  89. Tzais Geonim 4.88º
  90. Tzais Geonim 5.95º
  91. Tzais Geonim 7.083º
  92. Tzais Geonim 8.5º
  93. Tzais 72
  94. Tzais 72 Zmanis
  95. Tzais 16.1º
  96. Tzais 90
  97. Tzais 90 Zmanis
  98. Tzais 18º
  99. Tzais 19.8º
  100. Tzais 96
  101. Tzais 96 Zmanis
  102. Tzais 26º
  103. Tzais 120
  104. Tzais 120 Zmanis
  105. Shaah Zmanis GRA
  106. Shaah Zmanis 72 Minutes
  107. Shaah Zmanis 72 Minutes Zmanis
  108. Shaah Zmanis 16.1º
  109. Shaah Zmanis 90 Minutes
  110. Shaah Zmanis 90 Minutes Zmanis
  111. Shaah Zmanis 18º
  112. Shaah Zmanis 19.8º
  113. Shaah Zmanis 96 Minutes
  114. Shaah Zmanis 96 Zmanis
  115. Shaah Zmanis 26º
  116. Shaah Zmanis 120 Minutes
  117. Shaah Zmanis 120 Zmanis
  118. Shaah Zmanis Ateret Torah
  119. Tchilas Zman Kidush Levana 3 Days (beta)
  120. Tchilas Zman Kidush Levana 7 Days (beta)
  121. Sof Zman Kidush Levana Between Moldos (beta)
  122. Sof Zman Kidush Levana 15 Days (beta)

26 thoughts on “Zmanim Project

  1. Shmuel Weisberg

    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

    Reply
  2. KosherJava Post author

    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.

    Reply
  3. Jack Cohen

    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?

    Reply
  4. Pingback: KosherJava » Plans for a Zmanim API FAQ

    1. Bahaltener

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

      Reply
      1. KosherJava Post author

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

        Reply
  5. Pingback: KosherJava » KosherJava Zmanim API Released Under the LGPL License

  6. Bernard Seeff

    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.

    Reply
    1. KosherJava Post author

      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 “ויקרא ראש חודש ניסן”
      Reply
  7. Pingback: AstronomicalCalendar has a problem with half hour timezones. » Moishe Beshkin

  8. Kfir

    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.

    Reply
    1. KosherJava Post author

      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.

      Reply
  9. Nesanel

    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 Misheyakir is 7 degrees below the horizon. (See http://www.star-k.org/kashrus/kk-whendoesonepraywhenthereisnoday.htm) 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.

    Reply

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>