Posted by & filed under Developers, APIs, RSS Feeds, Source Code.

We offer a simple API for converting between Gregorian and Hebrew dates. Two output formats are supported: JSON and XML.

To convert from Gregorian to Hebrew date use this URL format:

http://www.hebcal.com/converter/?cfg=json&gy=2011&gm=6&gd=2&g2h=1

  • gy=2011 – Gregorian year
  • gm=6 – Gregorian month (1=January, 12=December)
  • gd=2 – Gregorian day of month
  • g2h=1 – Convert from Gregorian to Hebrew date
  • gs=on – After sunset on Gregorian date
  • cfg=json – output format is JSON (cfg=json) or XML (cfg=xml)

To convert from Hebrew to Gregorian use this URL format:

http://www.hebcal.com/converter/?cfg=json&hy=5749&hm=Kislev&hd=25&h2g=1

  • hy=5749 – Hebrew year
  • hm=Kislev – Hebrew month (Nisan, Iyyar, Sivan, Tamuz, Av, Elul, Tishrei, Cheshvan, Kislev, Tevet, Shvat, Adar1, Adar2)
  • hd=25 – Hebrew day of month
  • h2g=1 – Convert from Hebrew to Gregorian date
  • cfg=json – output format is JSON (cfg=json) or XML (cfg=xml)

Note also an optional callback parameter:

  • callback=function – wraps the JSON output text in parentheses and a function name of your choosing. Callback function names may only use upper and lowercase alphabetic characters (A-Z, a-z), numbers (0-9), the period (.), the underscore (_).

Sample output in JSON:

{"gy":2011,"gm":6,"gd":2,
"hy":5771,"hm":"Iyyar","hd":29,
"hebrew":"כ״ט בְּאִיָיר תשע״א"
}

Sample output in XML:

<?xml version="1.0" ?>
<hebcal>
<gregorian year="2011" month="6" day="2" />
<hebrew year="5771" month="Iyyar" day="29" str="כ״ט בְּאִיָיר תשע״א" />
</hebcal>