The Jalaali calendar has a natural/universal character. It spans across a cycle of four full seasons of the year starting with the first day of spring (for the northern hemisphere). It also has a regular (but not uniform) distribution of days per month. The first six months all have 31 days and the second six months all have 30 days in leap years, with the last month having 29 days in non-leap years. The calendar is roughly mapped onto the familiar Zodiac system in the west.
The Gregorian calendar differs from Jalaali in both respects. Here, there is no direct correspondence between the year and the natural seasons. Also, the months have arbitrary length of seven 31 days, four 30 days and one 28/29 days interleaved irregularly.
Moreover, the Jalaali year follows closely the movement of the earth (round the sun). A natural solar year is approximately 365 days, 5 hours and 49 minutes. For the Jalaali calendar, it begins (tahvil-e saal) at the point when the sun appears to cross the equator from the southern hemisphere to the northern hemisphere as viewed from the center of the earth. Then for the purposes of the calendar, if the exact moment of tahvil-e saal is before midday (Tehran time), the same day is regarded as the New Year's Day (1st Farvardin). Otherwise, the New Year begins in the following day. The convention results in 8 leap years in every cycle of (roughly) 33 years. The leap years are, currently, those with a remainder (after dividing by 33) of 1, 5, 9, 13, 17, 22, 26, and 30. For instance, 1370 divided by 33 leaves 17 as the remainder, and so it was a leap year. The next leap year will be 1375 - with a four year gap, rather than the usual three, between the two leap years.
The Gregorian calendar uses a simplified convention which has the effect of greater variance with the natural year. Here, the leap years are fixed for every fourth year except for the years which are divisible by 100 but not by 400. So, the year 2000 will be a leap year (as it is divisible by 400) but not, say, 2100.
The program takes all these factors into account. However, it should be noted that the Gregorian calendar was last modified in 1582 AD. Also, due to the fact that the Jalaali year follows closely the movement of the earth (and based on the time declared by Dr. Iraj Malekpoor of Tehran Geophysics Institute for the 1372 tahvil-e saal), the table of leap years in a the 33-year cycle may change early in the 17th century hejri by the four-year gap being pushed one step back. Similarly, if we use the Jalaali calendar retrospectively, a similar distortion may be seen around 1110 by the gap being pushed ahead one step. (The present Jalaali calendar was last re-introduced early this century. Before then its use was restricted mainly to astronomy/astrology.)
Taking these possibilities into account, the conversion should be correct for the years between 1734-2254 of Gregorian calendar and 1112-1633 of Jalaali calendar. But for the dates outside these ranges some modifications may need to be made.
For more details about the two calendars see ``The Great Leap Years Gap'' obtainable by ftp from tehran.stanford.edu.
Please forward your questions to firstname.lastname@example.org