jdn_hebrew

Description

jdn_hebrew converts a provided  Julian day number into a Hebrew date. Julian day number 347998 corresponds to the Hebrew date Tishri 1 of the Hebrew year 1, which is the day when the earth is supposed to have been created. Julian day numbers less than 347998 result in zero-values.

Gory details

jdn_hebrew is based on a mathematical representation of the lunar month. jdn_hebrew takes one input argument: the Julian Day Number. The other arguments: the Hebrew year, the Hebrew month and the Hebrew day, are output parameters. After calling jdn_hebrew these output parameters will contain the Hebrew date corresponding with the provided Julian Day Number.

The optional input argument monthcoding determines how the months are represented. The first six months (Tishri trhu Adar or Adar I) are always represented as a positive integer. If monthcoding is a negative number, then the rest of the months (either Adar II thru Elul or Nisan thru Elul, depending on whether the hebrew year is a leap year or not) are represented as a negative integer, where -1 is the last month of the year (Elul), -2 is the last but 1 month (Av) et cetera. See also

This routine uses several helper routines, which are described on ohter pages of this web site.

If you need to know the name of the month, use Hebrew_MonthName

Code section

Sub jdn_hebrew(ByVal jdn As Long, _
               ByRef iYear As Integer, _
               ByRef iMonth As Integer, _
               ByRef iDay As Integer, _
               Optional ByVal monthcoding As Integer = UnSigned)
    Dim InputJDN As Long
    Dim tishri1 As Long
    Dim LeftOverDays As Long
    If jdn <= 347997 Then
        iYear = 0
        iMonth = 0
        iDay = 0
    Else
        InputJDN = jdn - 347997
        iYear = (InputJDN \ 365) + 1
        tishri1 = Hebrew_ElapsedCalendarDays(iYear)
        While (tishri1 > InputJDN)
            iYear = iYear - 1
            tishri1 = Hebrew_ElapsedCalendarDays(iYear)
        Wend
        iMonth = 1
        LeftOverDays = InputJDN - tishri1
        While (LeftOverDays >= Hebrew_LastDayOfMonth(iYear, iMonth))
            LeftOverDays = LeftOverDays - Hebrew_LastDayOfMonth(iYear, iMonth)
            iMonth = iMonth + 1
        Wend
        If Sgn(monthcoding) = Signed Then
            If iMonth > 6 Then
                If Hebrew_LeapYear(iYear) Then
                    iMonth = iMonth - 14
                Else
                    iMonth = iMonth - 13
                End If
            End If
        End If
        iDay = LeftOverDays + 1
    End If
End Sub

See also

hebrew_jdn, Hebrew_MonthName, Hebrew_ElapsedCalendarDays, Hebrew_LastDayOfMonth, Claus Tøndering's Calendar Faq

Last update

Julian Day Number: 2452096
Civil (Gregorian) date: 5 July 2001
Julian date: 22 June 2001
Hebrew date: 14 Tammuz 5761
Islamic date: 13 Rabi' II 1422

Back to Calendar Math.
mail me
Kees Couprie
Other pages by the same author.