Zmanim Q & A Forum

KosherJava Zmanim Q & A
From time-to-time users of this site contact me with zmanim related questions, both technical and halachic. While I do not mind answering these questions, an open forum is probably more helpful to a greater audience. Please feel free to post your zmanim questions and comment here. While the target of this API were Java programmers, the vast majority of questions/comments are not related to the actual API. Here are some recent questions received (made generic).

  • Q: Can you let me know what calculations/opinion is used by the zmanim shown at [link removed]? I tried contacting the owner of the site but no one replied.
    A: I was able to answer the user based on information on the site and comparing the zmanim.
  • Q: What opinion does zman XYZ follow?
    A: The information can be seen in the Javadocs, and I added additional information in the email to the user.
  • Q: How can I use your API in JavaScipt/Ruby/PHP/C#/C++/Obj-C etc, etc
    A: The API is written in Java. The Zmanim API was already ported to many languages. The API is currently ported to

    If you are looking for it in different programming languages, a port is likely needed. I am more than willing to help guide you and make changes to my API to allow easier porting, but this is not something that I have the time to do myself.

  • Q: Your zmanim spreadsheet does not show a time for tzais as X minutes after shkiah etc.
    A: In some of these cases I actually added zmanim to the API, but for the less commonly used times, I point the questioner to the API with a sample on how to generate the requested zman. The API is very flexible, and almost every zman pointed out to me was very easy to generate
  • Q: Why are your zmanim 2 minutes different than [link removed].
    A It is not always clear what exact coordinate was used to generate those zmanim or what rounding was done by the author. If you provide more detailed information (usually by contacting the author of that calendar) you will usually find that the 2 can be matched
  • Q: I want to incorporate a Luach on my site, can you help?
    A: Yes, the KosherJava API has full Luach support. Zmanim are based on a solar year, and there is no need for the Hebrew date for the calculations of zmanim (with the exception of kiddush levana times), but full Hebrew calendar support is part of the API. This was based on Avrom Finkelstien’ java API for a Luach released in in 2002 (a cache is available via the The Wayback Machine). It was modified and integrated it into the KosherJava Zmanim API.
  • Q: I found the following bug in the API!!!
    A: I welcome these reports even though the majority are not bugs at all. You can contact me directly or post it to the KosherJava zmanim GitHub issues list.

60 thoughts on “Zmanim Q & A Forum”

  1. Hi ,
    Thanks for sharing ,
    I am trying to find an example for using the Zman Class ,
    I wish to send a date and get it in Hebrew format .

    I am trying to as fllow :

    Date d1 = new Date();
    Zman _zman =new Zman(d1,”MyNewTime”); (what the label an the zman constructor use for?)

    _zman.setZman(d1) ;

    then here i want to display my new Hebrew date ,
    can i do that with the zman class ?

    Thanks Zohar

      1. There is documentation for this in the base AstronomicalCalendar class. ZmanimCalendar and ComplexZmanimCalendar should behave the same way.

        // To get the time of sunrise, first set the date.
        // If not set, the date will default to today.
        AstronomicalCalendar ac = new AstronomicalCalendar(location);
        ac.getCalendar().set(Calendar.MONTH, Calendar.FEBRUARY);
        ac.getCalendar().set(Calendar.DAY_OF_MONTH, 8);
        Date sunrise = ac.getSunrise();
        
  2. Please look at this site. zmanim is a bottom of page but the zmanim is not showing

    Luach for Ohev Tzedek-Shaarei Torah
    4 Shevat 5771
    ד’ שבט תשע”א

    Zmanim
    Alos HaShachar:
    Netz:
    Earliest Tallis:
    Latest Sh’ma:
    Chatzos:
    Mincha Gedola:
    Mincha Ktana:
    Plag Hamincha:
    Shkiah:
    Hide
    Shabbos

    It will come in 6 days.
    Candle light :
    Shabbos ends:

    Do I need to configure something else?
    Thank you,
    Dave

    1. Charles,
      Thanks for your interst. This site is targeted mostly at software developers interested in using zmanim in their programs. That said, there are 2 very easy to use ways to get the zmanim you require

      • The Zmanim Map. This is a quick way to get the zmanim for the current day on a map
      • Zmanim Calendar Generator. This will generate a spreadsheet with zmanim for the entire year. You will also find a link to this on the bottom of the zmanim list in the Zmanim Map

      Please let me know if there is anything specific that you are looking for.

      1. you wrote “Zmanim Calendar Generator. This will generate a spreadsheet with zmanim for the entire year. You will also find a link to this on the bottom of the zmanim list in the Zmanim Map” I tries clicking on “Zmanim Calendar Generator” and the link was dead.
        Thanks

  3. Hy,

    can you please tell me any function in this api to check its holiday in jewish calendar for specific date …

    i need to list of all holidays list of jewish calendar , list of days of Rosh Chodesh holidays , and Omer holidays number.. i checked in libhdate provide all functions , but i not found these all functions or functionality in this api.. can you please inform me below all functions are available in java api or not ?

    i need below all functions functionality…

    – get_holyday_type() — the holiday type
    – get_omer_day() — get the day of the omer
    – get_holyday_string() — string of hebrew holiday name
    – get_holyday() — the hebrew holiday number

    any other suggestion welcome.

    Thanks

      1. Thanks for your quickly reply..

        i checked net.sourceforge.zmanim.hebrewcalendar package but not found specific function which i mentioned my above post..

        can you give me some description or some suggestion for how to check specific date is current holiday or not and if holiday then i need to holiday name.. i checked hebrewcalendar package but not found or not understand which function i use so please any suggestion..

        Thanks

        1. Samit,
          Here is some sample code. I am afraid that I can’t offer any additional help at this point. The code below should have been pretty clear from the JavaDocs.

          JewishCalendar jd = new JewishCalendar(); //current date
          HebrewDateFormatter hdf = new HebrewDateFormatter();
          System.out.println(jd); //prints hebrew date in English chars - 24 Teves, 5772
          System.out.println(jd.getDayOfOmer()); //-1 since there is no omer count this time of year
          System.out.println(hdf.formatYomTov(jd)); //nothing printed since it is not a holiday
          jd.setJewishDate(5772, JewishDate.NISSAN, 18); //change date to one that is a holiday and has an Omer count
          System.out.println(jd.getDayOfOmer()); //3rd day of omer
          System.out.println(hdf.formatOmer(jd));
          System.out.println(hdf.formatYomTov(jd)); //Chol Hamoed Pesach
          hdf.setHebrewFormat(true); //change formatting to Hebrew
          System.out.println(hdf.format(jd)); //date formatted in Hebrew
          System.out.println(hdf.formatOmer(jd)); //3rd day of Omer in Hebrew
          System.out.println(hdf.formatYomTov(jd)); //Chol Hamoed Pesach in Hebrew
          
  4. Hello KosherJava ,

    Again Thanks for earlier helps…

    can you please solve my questions regarding api.

    i need to jewish holiday list of year , when i passed year then return all holiday names and dates.

    i implemented this way : pass date and check its holiday but this way i pass all days of year and get response of api is holiday its takes more time to check whole year.

    so any function in api which return all jewish holidays name and dates when i passed year in function.

    Please tell me any another way to get all holidays list and dates of year quickly.

    Thanks

  5. Hi there,

    I’m getting an app built to show the time in shaot zmaniot and allow users to set alarms and reminders based on the zmanim (e.g. x mins before 4:00 Daytime for shacharit).

    As part of the app, we’ll be adding some notifications on dates in the jewish calendar, and would love to add the 5 d’rabanan fast days along with a reminder the day before (or that morning) that it’s a fast day.

    Are there any plans to add fast days to the hebrew calendar part of the app? It’s non-trivial to add ourselves what with the various halachot of bringing forward/pushing back when they fall no shabbat (like this year), so hoping there’s a pre-coded add on available for it.

    Thanks!
    Benjy

  6. The link that you showed me is only for mobile phones and I would like either a spreadsheet or a program that can output to a spreadsheet. The Zmanim calendar is very comprehensive but I would like to have an offline version and also, something that shows fast days, as these can vary according to the day of the week.

  7. Is anyone else having a problem with sunrise and sunset times on the 2013 zemanim spreadsheet? I generated the spreadsheet using my synagogue’s Google Maps location data–same as last year–and all the times are correct EXCEPT sunrise and sunset, which are three minutes (or perhaps three days) off when compared to 2012 and when compared to other reference material. Is this an algorithm or data input issue??

    1. David,
      Thank you very much for pointing this out to me. The problem in the Zmanim Calendar is now resolved (though you will see from my explanation below that it was not a real issue). Last year when you set your location you did not set the elevation, so the calendar calculated it for sea level. This year, with Google Map integration, I automated the elevation look-up. The calendar always used elevation adjusted sunrise and sunset for the “standard” calendar, and both elevation adjusted and sea level for the “full” version, however, most people did not look up the elevation in the past, so sea level times were usually returned. Your location (as disclosed in an email) has an elevation of 186 meters above sea level, and this results in an almost 3 minute difference VS sea level. Calculated for January 7 for your location:
      Sunrise (186 meters): 7:43:57 AM
      Sunrise (Sea Level): 7:46:45 AM

      Since people using the standard calendar probably do not expect the elevation adjusted sunrise and set (although it is not wrong), and since most other calendars do not use elevation adjustment, I changed the calendar to now show sea level sunrise in the standard calendar. Ask your Rabbi about sea level VS elevation adjusted. You may want to see the following posts on elevation.

        1. Thanks for the clear explanation! I did check with my Rav and for our particular area/circumstance we decided to use sea level for Erev Shabbos as it is used by all the other Shuls in our area and because it’s earlier than true sunset–which benefits last-minute rushers like myself. This also means that to be machmir on Motzei Shabbos we should not be too hasty to end Shabbos (especially for those who hold the earliest zman) to avoid any issues. Of course if someone is below sea level the ruling might be quite different and a Rav should be consulted.

          –David

    2. Greetings,

      I’ve used your Direction to Yerushalaim applet numerous times over the years – thank you for such a useful tool! However, a couple or four years ago the search button has disappeared, so now I have to zoom and drag. Your instructions still reference a “search field on the bottom right,” but I see no such thing in either Chrome or Firefox. What am I doing wrong?
      Thanks,

    3. Hello

      Thank you for a very interesting website.

      However, when I tried to use the calendar I thought that I got ridiculous values, but as I was detailing the question, I realized that the labels at the top are off by 1 column. Column E is blank in the data, but the labels start above it. So Alos 16.1 degrees is above the blank column, and everything else is off by one. I do not think this is the result of something I did wrong. I am using Latitude: 31.79984, Longitude: 35.21846; Elevation: 756.43; Time Zone: Asia/Jerusalem

      1. Chaim,
        Zmanim for Necker Island can be seen on the KosherJava Zmanim Map. Just enter Necker Island in the search field on the bottom left corner. The search will bring you to the Zmanim map zoomed in on Necker Island. Since it is nowhere near the IDL (International Dateline), and is in fact the same longitude as Nova Scotia, Canada, there should be no issue from that aspect either. See the KosherJava International Dateline map zoomed in on Necker Island to see the location in relation to the IDL. I can’t even begin to guess as to kosher food there. Have a look around Dan’s Deals for those type of travel related questions.

        Have a safe and enjoyable trip.

    4. i dont understan why do not work for me. the time of sunrise and other are wrong

      this is my code… for lat lon ele : Elad Israel

              String locationName = hloc;
              double latitude = Double.valueOf(hlat); //latitude of Lakewood, NJ
              double longitude = Double.valueOf(hlon); //longitude of Lakewood, NJ
              double elevation = Double.valueOf(hele); //optional elevation
      
              TimeZone timeZone = TimeZone.getTimeZone("Asia/Jerusalem");
              //create the location object
              GeoLocation location = new GeoLocation(locationName, latitude, longitude, elevation, timeZone);
              location.setElevation(139.60);
              location.setLatitude(32,2,58.44,"N");
              location.setLongitude (34,57,18.92,"E");
              SunTimesCalculator sn = new SunTimesCalculator();
      
              ZmanimCalendar zc = new ZmanimCalendar(location);
              ComplexZmanimCalendar czc = new ComplexZmanimCalendar(location);
              Date sunrise = czc.getSunrise();
              Date alos14 = czc.getSunriseOffsetByDegrees(AstronomicalCalendar.ASTRONOMICAL_ZENITH + 14);
              Date minchaGedola = czc.getTimeOffset(czc.getAlos16Point1Degrees(), czc.getShaahZmanis16Point1Degrees() * 6.5);
              Date candle = czc.getCandleLighting();
              Log.i("candle ", candle.toString());
              Log.i("Today's Zmanim for ", locationName);
              Log.i("sunrise",sunrise.toString());
      

      //////////////////////////////// LOG INFO
      04-28 00:23:12.892 28223-28223/com.myluaj.zmanim I/candles: Thu Apr 28 12:00:58 EDT 2016
      ????????? candles at 12:00 ??????????
      04-28 00:23:12.893 28223-28223/com.myluaj.zmanim I/Today’s Zmanim for: Elad, Israel
      04-28 00:23:12.893 28223-28223/com.myluaj.zmanim I/sunrise: Wed Apr 27 22:54:48 EDT 2016
      ?????????SUNRISE AT 22:54 Hs??????

      1. Asher,
        Your mistake is trivial and was addressed in an old post FAQ: Outputting Zmanim for A Different Time Zone With the the Zmanim API. Based on the output you provided, I see that your device/computer is set to a different timezone than Israel (ETD – Eastern Daylight Savings time). This results in the output of the date being formatted based on the time zone of your local computer.

        Also, I do not know what the values of hlat, hlon etc. are, but you are setting them twice. Once when calling the GeoLocation constructor, and the second time when you call

        location.setLatitude(32,2,58.44,"N");
        

        I assume that this is just leftover code.

    5. Good Afternoon,
      I have a few questions and I’ll appreciate very much if anyone could please help me. Or give me some ideas.

      So I have a programmer that is going to design a shul schedule, builtin and zman calendar in one. He will most likely be using excel to build it. Since they are not jewish, I didn’t go much in to detail with them about the concept of Alos, netz, mincha, plag, etc… I just need to tell him which zman goes to which line.

      I did find the myzmanim.com excel file. And I did ask them a few questions. But as of now its not availbe. But they saif If I find it somewhere I could just ad it as another column. Since the programmer is an expert with excel. They will have no issue with adding a few columns so its part of the caluation. (If I’m not mistaking, I did find an excel file on this site as well, But I think this one had much less options. If there is something I didn’t see please guide me to it)
      For example, to make a column that will calculate that the time for Mariv motzei Shabbos, is 8 minutes before 72min. that the Programer could do. Or Mincha Friday Afternoon, 10 minutes after candle lighting. And most of the columns are in there.

      But these are my main questions. Since myzmanim.com can’t provide it. And I’d like very much to get in there.

      #1 the Seferas haomar is in alef Bet order, Anyone have it in the way we say it? היום יום אחד & the shem for that day נצח etc… I think it would be a nice addition.

      #2 If there would be a way to ad A moled column for Shabbos mvorchem, And a column that would show the days of Rosh Chodesh on shabbos as well
      Example: שבת מברכים חודש אלול
      שבת קודש, יום ראשון
      12:30 AM מולד יום שני
      etc… 1 ושני חליקים אחר
      just an example. They do give moled, But I’m not sure its editable. If It is, I could ask the programmer if he could ad a column and set it so it shows on Shabbos day or until the start of Kidush levana,
      Which leads to the next question.

      It would be amazing, If anyone knows and has the know how, to add a column that will show the kidush levana, from the proper time. (our cumtom is zeven shleimim.) and somehow show, something like, סוף זמן קידיש לבנה Monday afternoon at 3:16 PM etc.. A count down would be even nicer. Example: 5 days & 2 hours and 3 minutes. But that is asking for to much.

      Any ideas would be very greatly appreciated.

      have a gut g’betched year.

    6. Hi,

      Thank you very much for the API im currently trying to use it for an app im making.
      I just wanted to ask I cant find a method to get the time for Havdallah/Shabbat ends, am I supposed to be calculating it or getting it from another method. If so could you tell me how, I know there are varying halachic opinions but I just want to calculate it the most held off way, whichever way its most likely to be found if I just pick up a jewish calendar somewhere, I assume that for havdallah RT I just use the Tzezis72 method? But I care more about regular havdallah time. And if I get it from another method do I calculate it as certain minutes from sunset or from tzeit??? Bit confused.

      Thanks

    7. Eliyahu,
      Thanks so much for this API, I’ve used it many times in my programming.
      I’m working on a program where I start with a Jewish month / day and get generate yurtzeit dates for the next number of years.
      The issue is that if the yurtzeit month is 13, I need a way to check if the current year is a leap year. If it isn’t the API throws an exception, as it should.
      I wanted to use JewishDate.isJewishLeapYear(year) to test for leap year but this method is declared as private. I would like to ask that method be made public.
      Perhaps you would consider make a “getYurtzeit()” function 🙂
      Thanks again, Brocho V’Hatzlocha!

      1. Dovid,
        This is interesting and I will have to look into it. The main issue I see is that there are other “edge” cases such as a person passing away on 30 Marcheshvan on a maleh year. If the first yahrzeit is a chaser, there are differing opinions. There are other such cases. Since there is not a straight forward answer, just addressing your example with a getYahrtzeit() method would leave people assuming that it “just works” for all cases. I would have to allow parameters and set flags on the class to allow setting the proper minhag. This is something probably best discussed on the #zmanim channel on the Frum Developer’s Slack. Please contact me for details.

    Leave a Reply

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