If  you wish  to  write  your own  hdate  program,  here are  the
principles. They are based on  common knowledge and a book called
'the 6000-year  calendar' by A.  Akavia (I  don't know if  it was
ever translated from Hebrew). The given algorithm is the one used
currently (others were  used in different times  in history), and
is in use since about the 10th century A.D.

The calendar is lunisolar - each  year starts close to the autumn
equinox, but each  month starts at the new moon.  Dates change at
sunset, so the 1st day of the  month is the one following the new
moon. Months are alternately 30 and  29 days long, and are named:
Tishrey, Heshvan, Kislev, Tevet, Shvat, Adar, Nisan, Iyar, Sivan,
Tamuz, Av and Elul. (In biblical times, the year used to start at
Nisan.) A standard year is therefore 354 days long.

In leap years, an extra month  of 30 days is inserted before Adar
(which used  to be the last  month), and the 2  Adar's are called
'Adar a'  and 'Adar  b'. Leap  years occur 7  times in  a 19-year
cycle, and are years 3, 6, 8,  11, 14, 17 and 19. A standard leap
year is 384 days long.

For various reasons of religious practices, the year cannot start
on a Sunday, Wednesday or a Friday. If an adjustment is needed, a
day is added to Heshvan or  taken off Kislev. Thus a regular year
may be 353 to 355 days long, and a leap year - 383 to 385.

Now, to the computation: each day  starts at 6 p.m., and consists
of 24 hours; the hour is sub-divided into 1080 'parts'. The month
is 29 days,  12 hours and 793 parts long  (let's use the notation
12h793). In all computations, we  are only interested in the time
of the new moon modulu one week; the starting point (1st new moon
of year  1) is Monday, 5h204,  i.e. 23:11:20. To give  you a more
recent  clue, year  5701 started  (exactly 300  cycles later)  on
Thursday, Oct. 3, 1940. The new moon was on Wednesday, 2h504.

Given  a date,  find the  number of  days since  a pre-calculated
starting point (preferably a new  moon of Tishrey), then subtract
cycles and years to arrive at the new moon of the requested year,
and calculate  its offset into  the week. If  one or more  of the
following conditions are true, the new year is delayed by one (or
2, see below) days:

1) The hour >= 18 (i.e. after noon);
2) Day is a Tuesday, and the hour >= 9h204 in a non-leap year;
3) Day is a Monday, and the  hour >= 15h589 and the previous year
   is a leap year;
4) Day is a Sunday, a Wednesday or a Friday.

(Note  that the  delay because  of  1-3 may  cause another  delay
because of 4, and  the new year would start 2  days after the new
moon. Rule 1 is to make sure the new moon is seen after sunset on
the first day; rules  2 and 3 are to prevent  a double delay from
creating a 356- or 382-day long year.)

Now do it again for the next  year, and you have the exact length
of the requested year, by which  you can determine the lengths of
Heshvan, Kislev, and (by year  number modulu 19, see above) Adar.
By what's left  of the day number  in the year, you  can find the
exact date.

I hope this is not too confusing!
