From: wmuhanna@magnus.acs.ohio-state.edu (Waleed A Muhanna)
Subject: Re: Calender conversion program wanted
Organization: The Ohio State University
Date: Sun, 8 Nov 1992 00:18:06 GMT

In article <BxB8zI.5sL@cs.vu.nl> mjabosm@cs.vu.nl (Mark Bosma) writes:
>Hello,
>
>I am looking for programs or formulas (so i can write my
>own program) for the conversion between the gregorian calender
>and the islamitic calender. If someone has any
>information on this subject please E-mail me.

I have developed software that does exactly what you want and more.
The procedure is fairly simple, except for one difficulty (see below).
I used some formulas and a few useful routines that I found in various
sources, chief among them is Jean Meeus' book "Astronomical Formulae for 
Calculators," Willmann-Bell, Inc., Richmond, Virginia, 1985.

I intend to release the software to the public as soon as I find the 
time to clean it up and to validate it more thoroughly.  Please don't 
write to me asking for it at this time; I'll posted it here in a couple
of weeks or so.  For now, here is some more information on it.  

First, an important caveat: The Islamic (commonly known as the Hijri) 
calendar is fundamentally based upon lunar cycles.  However, for historical 
and some even say religious reasons, the beginning of a Hijri month is marked 
not by the start of a new moon, but by a physical (i.e., an actual human) 
sighting of the crescent at a given locale.  (There is no agreed upon
international Lunar date-line, but that's a different sort of problem.)

Thus, no Hijri calendar software can be 100% reliable.  Computationally,
the best one can do is estimate the likelihood of the crescent being visible 
on a given night at a given locale after the start of the new moon.  
Using these estimates and a few heuristics, it is possible to 
compute the beginning of a Hijri month accurately most of the time.  
On a few occasions, however, the computation of the start of a new month may 
be off (usually by at most one day).  Such an error does not carry over to 
the following month; the start of each month is independently computed 
based on the start of the new moon.

The software is written in C, and it should be fairly portable.
It consists of two programs: `hdate' and `hcal'.  (These programs 
are fashioned after the standard UNIX commands, `date' and `cal',
respectively.)

`hdate' translates a given date to the Islamic/Hijri calendar.  
If no date is given, it uses today's date.

%hdate
Saturday 13 Jamaad Awal 1413h

One can also use `hdate' to convert back to the Gregorian calendar.
This way, for example, you can determine when RamaDHaan begins. (RamaDHaan
is the 9th month in the Hijri year.)

%hdate -h  1 9 1413
Monday 22 February 1993

The second program, `hcal', outputs a calendar with both Hijri and
Gregorian dates for the specified Hijri/Gregorian month/year.

%hcal 11 1992
November 1992 / Jamaad Awal - Jamaad THaany 1413
 Sun   Mon   Tue   Wed   Thu   Fri   Sat
 1/ 7  2/ 8  3/ 9  4/10  5/11  6/12  7/13
 8/14  9/15 10/16 11/17 12/18 13/19 14/20
15/21 16/22 17/23 18/24 19/25 20/26 21/27
22/28 23/29 24/30 25/ 1 26/ 2 27/ 3 28/ 4
29/ 5 30/ 6

%hcal -h 9 1413
RamaDHaan 1413 / February - March 1993
 Sun   Mon   Tue   Wed   Thu   Fri   Sat
       1/22  2/23  3/24  4/25  5/26  6/27
 7/28  8/ 1  9/ 2 10/ 3 11/ 4 12/ 5 13/ 6
14/ 7 15/ 8 16/ 9 17/10 18/11 19/12 20/13
21/14 22/15 23/16 24/17 25/18 26/19 27/20
28/21 29/22 30/23


Now, for Islamic history buffs out there, here is a quiz:

 When was the Hijri calendar first introduced and by whom?


>Mark.

Waleed Muhanna

-=-
Blessed are the young for they shall inherit the national debt.