Since the Persian calendar is a highly regular calendar, converting to and from a Julian Day Number is not as difficult as it looks. Basically it's a mather of dividing, rounding and multiplying.
This routine uses Julian Day Number 1948321 as focal point, since that Julian Day Number corresponds with 1 Farvardin (1) 1.
For detailed information on the calendar, see the page about the Persian Calendar.
Function persian_jdn(iYear As Integer, _
iMonth As Integer, _
iDay As Integer) As Long
Const PERSIAN_EPOCH = 1948321 ' The JDN of 1 Farvardin 1
Dim epbase As Long
Dim epyear As Long
Dim mdays As Long
If iYear >= 0 Then
epbase = iYear - 474
Else
epbase = iYear - 473
End If
epyear = 474 + (epbase Mod 2820)
If iMonth <= 7 Then
mdays = (CLng(iMonth) - 1) * 31
Else
mdays = (CLng(iMonth) - 1) * 30 + 6
End If
persian_jdn = CLng(iDay) _
+ mdays _
+ Fix(((epyear * 682) - 110) / 2816) _
+ (epyear - 1) * 365 _
+ Fix(epbase / 2820) * 1029983 _
+ (PERSIAN_EPOCH - 1)
End Function
| Julian Day Number: | 2452153 |
| Civil (Gregorian) date: | Friday, 31 August 2001 |
| Julian date: | Friday, 18 August 2001 |
| Hebrew date: | yom shishi, 12 Elul 5761 |
| Islamic date: | Al-Jum'ah, 12 Jumada II 1422 |
| Persian date: | Jomeh, 9 Shahrivar 1380 |
| Back to Calendar Math. |
Kees Couprie |
Other pages by the same author. |