This FAQ is now obsolete. Jewish Calendar Calculations are now supported. See the Zmanim API 1.3.0 Release announcement
How do I get the Jewish Date for … using the Zmanim API?
The current version of the Zanim API does not support Jewish calendrical calculations. Zmanim are almost exclusively based on the solar calendar, so for example, the sunrise on February 8th this year in Montreal (or any other date and location), will be almost the same every year. for this reason there was little point (as far as zmanim) to support Jewish date calculations in the API. One of the only zmanim to rely on a Jewish date is the sof zman kidush levanah calculation, though there are some opinions that it is purely molad based, and this can be calculated without a Jewish calendar component to the API. This zman is obviously not currently implemented in the Zmanim API. I am currently working on adding Jewish date support to the API. The code is based off Avrom Finkelstein‘s no longer active HebrewDate project. I refactored a lot of the code and fixed a number of bugs. Anyone interested in alpha testing this code can download the latest Zmanim SVN code.
I mentioned that it “will be almost the same every year” and this is due the approximate 1/4 day drift between the 356 day calendar year and the approximately 365.25 days actually present in the astronomical year, a discrepancy corrected every leap year. A future FAQ (probably a few of them) may delve specifically into this drift as well as general zmanim accuracy issues in detail.
If you are simply looking to convert a Hebrew date to Gregorian or Gregorian to Hebrew online without the API, try the JewishGen calendar conversion tools.
9 thoughts on “FAQ: How do I Calculate the Jewish/Hebrew Date for …?”
I don’t remember if I sent you proper review on the code, you provided me for Jewish date detection.
But still, I want to thank you very much for it. It was very useful and now I try to use it for custom Android date picker.
Check the page.
Thank you again for a nice piece of code 😉
You are very welcome. I will let you know when I have an update on the code. There are still bugs in the Parsha generation routine if you try to get the parsha of the week for the middle of the week. Jay Gindin plans on doing some major refactoring work to the date conversion classes. I will post more at a future date.
Now that you adding Hebrew dates calculations to your API, can you please also add boolean methods for Holidays and special Jewish dates? e.g. isHannuka(), isSefiratAhaomer(), isRoshChodesh() – including evening before, etc.?
Thank you for your interest. I updated the post above to include a link to the Zmanim API alpha 1 release that includes the calendar code. It is still under very heavy development. You can expect significant changes (that may break your code on an update) over the next few months. Please review the code and provide your comments here. There is currently no Rosh Chodesh support, but it will return yomim tovim.
RoshChodesh is as simple as the code below and I plan on adding it to the API. It also currently returns the day of the Omer (and an Integer.MIN_VALUE if it is not in the Omer).
Thanks for the code.
I already implemented similar code in my apps before, but as the Hebrew date algorithm I’m currently using is heavily depended on the Gregorian calendar, I had to make it more accurate for “Erev Rosh Chodesh”/”Erev Hannuka” – as for Arvit time before that date, the date is 28/29 but the Hebrew date actually became 30/1. So now each time I need to know if isRoshChodesh() I need to check tomorrow’s date as well, and split a single query into two – according to the time of day – isRoshChodesh() and isErevRoshChodesh(), etc.
As for some other yomim tovim, it becomes more complicated as for calculating Hannuka you need to check if it’s ended in 2 or 3 in Tevet as well, which is something you can do using the Gauss calculation, but it’s not so elegant (checking if 2/3 days ago the date was 29/30).
Now, as you developing this great addition to your API, it would be nice if this calculation will be done within the API code, and querying isRoshChodesh() will return the accurate answer for Erev Rosh Chodesh and will know to return false for Arvit time of the 1 day in month, and so on. I hope I made myself clear now.
At this point I do not plan on adding a time concept to the class, so in checking after Tzais you will have to query the next date. Also, since isRoshChodesh() returns a boolean, I can’t have it return true for erev rosh chodesh. Please let me know of any suggestions that you have.
There was a pretty significant bug in the code uploaded on Friday. Please re-downlolad the Zmanim API 1.3.0 Alpha 1 code if you downloaded it before 12:30 PM EST on Sunday March 6th.
Doesn’t anyone use pointers anymore… passing by reference….
Wait a sec….
Aaaahhhh! *bangs head on C programing book*