HebrewCalendar Class
Represents the Hebrew calendar.
Assembly: mscorlib (in mscorlib.dll)
| Name | Description | |
|---|---|---|
![]() | HebrewCalendar() | Initializes a new instance of the HebrewCalendar class. |
| Name | Description | |
|---|---|---|
![]() | AlgorithmType | Gets a value that indicates whether the current calendar is solar-based, lunar-based, or a combination of both.(Overrides Calendar.AlgorithmType.) |
![]() | DaysInYearBeforeMinSupportedYear | Gets the number of days in the year that precedes the year that is specified by the MinSupportedDateTime property.(Inherited from Calendar.) |
![]() | Eras | Gets the list of eras in the HebrewCalendar.(Overrides Calendar.Eras.) |
![]() | IsReadOnly | |
![]() | MaxSupportedDateTime | Gets the latest date and time supported by the HebrewCalendar type.(Overrides Calendar.MaxSupportedDateTime.) |
![]() | MinSupportedDateTime | Gets the earliest date and time supported by the HebrewCalendar type.(Overrides Calendar.MinSupportedDateTime.) |
![]() | TwoDigitYearMax | Gets or sets the last year of a 100-year range that can be represented by a 2-digit year.(Overrides Calendar.TwoDigitYearMax.) |
| Name | Description | |
|---|---|---|
![]() | AddDays(DateTime, Int32) | |
![]() | AddHours(DateTime, Int32) | |
![]() | AddMilliseconds(DateTime, Double) | |
![]() | AddMinutes(DateTime, Int32) | |
![]() | AddMonths(DateTime, Int32) | Returns a DateTime that is the specified number of months away from the specified DateTime.(Overrides Calendar.AddMonths(DateTime, Int32).) |
![]() | AddSeconds(DateTime, Int32) | |
![]() | AddWeeks(DateTime, Int32) | |
![]() | AddYears(DateTime, Int32) | Returns a DateTime that is the specified number of years away from the specified DateTime.(Overrides Calendar.AddYears(DateTime, Int32).) |
![]() | Clone() | |
![]() | Equals(Object) | Determines whether the specified object is equal to the current object.(Inherited from Object.) |
![]() | Finalize() | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.) |
![]() | GetDayOfMonth(DateTime) | Returns the day of the month in the specified DateTime.(Overrides Calendar.GetDayOfMonth(DateTime).) |
![]() | GetDayOfWeek(DateTime) | Returns the day of the week in the specified DateTime.(Overrides Calendar.GetDayOfWeek(DateTime).) |
![]() | GetDayOfYear(DateTime) | Returns the day of the year in the specified DateTime.(Overrides Calendar.GetDayOfYear(DateTime).) |
![]() | GetDaysInMonth(Int32, Int32) | Returns the number of days in the specified month and year of the current era.(Inherited from Calendar.) |
![]() | GetDaysInMonth(Int32, Int32, Int32) | Returns the number of days in the specified month in the specified year in the specified era.(Overrides Calendar.GetDaysInMonth(Int32, Int32, Int32).) |
![]() | GetDaysInYear(Int32) | Returns the number of days in the specified year of the current era.(Inherited from Calendar.) |
![]() | GetDaysInYear(Int32, Int32) | Returns the number of days in the specified year in the specified era.(Overrides Calendar.GetDaysInYear(Int32, Int32).) |
![]() | GetEra(DateTime) | Returns the era in the specified DateTime.(Overrides Calendar.GetEra(DateTime).) |
![]() | GetHashCode() | Serves as the default hash function. (Inherited from Object.) |
![]() | GetHour(DateTime) | |
![]() | GetLeapMonth(Int32) | Calculates the leap month for a specified year.(Inherited from Calendar.) |
![]() | GetLeapMonth(Int32, Int32) | Calculates the leap month for a specified year and era.(Overrides Calendar.GetLeapMonth(Int32, Int32).) |
![]() | GetMilliseconds(DateTime) | |
![]() | GetMinute(DateTime) | |
![]() | GetMonth(DateTime) | Returns the month in the specified DateTime.(Overrides Calendar.GetMonth(DateTime).) |
![]() | GetMonthsInYear(Int32) | Returns the number of months in the specified year in the current era.(Inherited from Calendar.) |
![]() | GetMonthsInYear(Int32, Int32) | Returns the number of months in the specified year in the specified era.(Overrides Calendar.GetMonthsInYear(Int32, Int32).) |
![]() | GetSecond(DateTime) | |
![]() | GetType() | |
![]() | GetWeekOfYear(DateTime, CalendarWeekRule, DayOfWeek) | |
![]() | GetYear(DateTime) | Returns the year in the specified DateTime value.(Overrides Calendar.GetYear(DateTime).) |
![]() | IsLeapDay(Int32, Int32, Int32) | Determines whether the specified date in the current era is a leap day.(Inherited from Calendar.) |
![]() | IsLeapDay(Int32, Int32, Int32, Int32) | Determines whether the specified date in the specified era is a leap day.(Overrides Calendar.IsLeapDay(Int32, Int32, Int32, Int32).) |
![]() | IsLeapMonth(Int32, Int32) | Determines whether the specified month in the specified year in the current era is a leap month.(Inherited from Calendar.) |
![]() | IsLeapMonth(Int32, Int32, Int32) | Determines whether the specified month in the specified year in the specified era is a leap month.(Overrides Calendar.IsLeapMonth(Int32, Int32, Int32).) |
![]() | IsLeapYear(Int32) | Determines whether the specified year in the current era is a leap year.(Inherited from Calendar.) |
![]() | IsLeapYear(Int32, Int32) | Determines whether the specified year in the specified era is a leap year.(Overrides Calendar.IsLeapYear(Int32, Int32).) |
![]() | MemberwiseClone() | |
![]() | ToDateTime(Int32, Int32, Int32, Int32, Int32, Int32, Int32) | |
![]() | ToDateTime(Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32) | Returns a DateTime that is set to the specified date and time in the specified era.(Overrides Calendar.ToDateTime(Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32).) |
![]() | ToFourDigitYear(Int32) | Converts the specified year to a 4-digit year by using the TwoDigitYearMax property to determine the appropriate century.(Overrides Calendar.ToFourDigitYear(Int32).) |
![]() | ToString() | Returns a string that represents the current object.(Inherited from Object.) |
The Hebrew calendar recognizes two eras: B.C.E. (before the common era) and A.M. (Latin "Anno Mundi", which means "the year of the world"). This implementation of the HebrewCalendar class recognizes only the current era (A.M.) and the Hebrew years 5343 to 5999 (1583 to 2239 in the Gregorian calendar).
Note |
|---|
For information about using the HebrewCalendar class and the other calendar classes in the .NET Framework, see Working with Calendars. |
In every 19-year cycle that ends with a year that is evenly divisible by 19, the 3rd, 6th, 8th, 11th, 14th, 17th, and 19th years are leap years. A common year can have from 353 to 355 days, depending on the placement of Jewish holidays. A leap year can have from 383 to 385 days.
The Hebrew calendar has 12 months during common years and 13 months during leap years:
GetMonth value (common year) | GetMonth value (leap year) | Month | Days in common years | Days in leap years |
|---|---|---|---|---|
1 | 1 | תשרי (Tishrei) | 30 | 30 |
2 | 2 | חשון (Cheshvan) | 29/30 | 29/30 |
3 | 3 | כסלו (Kislev) | 29/30 | 29/30 |
4 | 4 | טבת (Tevet) | 29 | 29 |
5 | 5 | שבט (Shevat) | 30 | 30 |
6 | - | אדר (Adar) | 29 | - |
- | 6 | אדר א (Adar Alef) | - | 30 |
- | 7 | אדר ב (Adar Beit) | - | 29 |
7 | 8 | ניסן (Nissan) | 30 | 30 |
8 | 9 | אייר (Iyar) | 29 | 29 |
9 | 10 | סיון (Sivan) | 30 | 30 |
10 | 11 | תמוז (Tamuz) | 29 | 29 |
11 | 12 | אב (Av) | 30 | 30 |
12 | 13 | אלול (Elul) | 29 | 29 |
The days in Cheshvan and Kislev vary depending on the placement of Jewish holidays. During leap years, Adar is replaced by Adar Alef with 30 days and Adar Beit with 29 days. Adar Alef is considered the leap month. The last day of Adar Alef and all the days in Adar Beit are considered leap days; that is, the IsLeapDay method returns true for these days.
The date January 1, 2001 A.D. in the Gregorian calendar is equivalent to the sixth day of Tevet in the year 5761 A.M. in the Hebrew calendar.
Each CultureInfo supports a set of calendars. The Calendar property returns the default calendar for the culture, and the OptionalCalendars property returns an array containing all the calendars supported by the culture. To change the calendar used by a CultureInfo, the application should set the Calendar property of CultureInfo.DateTimeFormat to a new Calendar.
The following example creates a file that contains the date ranges supported by the HebrewCalendar class, and displays the number of days in each month of the year 5772.
Imports System.Globalization Imports System.IO Imports System.Threading Module Example Public Sub Main() Dim output As New StreamWriter("HebrewCalendarInfo.txt") ' Make the Hebrew Calendar the current calendar and ' Hebrew (Israel) the current thread culture. Dim hc As New HebrewCalendar() Dim culture As CultureInfo = CultureInfo.CreateSpecificCulture("he-IL") culture.DateTimeFormat.Calendar = hc Thread.CurrentThread.CurrentCulture = culture output.WriteLine("{0} Information:", GetCalendarName(culture.DateTimeFormat.Calendar)) output.WriteLine() ' Get the calendar range expressed in both Hebrew calendar and ' Gregorian calendar dates. output.WriteLine("Start Date: {0} ", hc.MinSupportedDateTime) culture.DateTimeFormat.Calendar = culture.Calendar output.WriteLine(" ({0} Gregorian)", hc.MinSupportedDateTime) output.WriteLine() culture.DateTimeFormat.Calendar = hc output.WriteLine("End Date: {0} ", hc.MaxSupportedDateTime) culture.DateTimeFormat.Calendar = culture.Calendar output.WriteLine(" ({0} Gregorian)", hc.MaxSupportedDateTime) output.WriteLine() culture.DateTimeFormat.Calendar = hc ' Get the year in the Hebrew calendar that corresponds to 1/1/2012 ' and display information about it. Dim startOfYear As Date = #1/1/2012# output.WriteLine("Days in the Year {0}: {1}", hc.GetYear(startOfYear), hc.GetDaysInYear(hc.GetYear(startOfYear))) output.WriteLine() output.WriteLine("Days in Each Month of {0}:", hc.GetYear(startOfYear)) output.WriteLine() output.WriteLine("Month Days Month Name") ' Change start of year to first day of first month startOfYear = hc.ToDateTime(hc.GetYear(startOfYear), 1, 1, 0, 0, 0, 0) Dim startOfMonth As Date = startOfYear For ctr As Integer = 1 To hc.GetMonthsInYear(hc.GetYear(startOfYear)) output.Write(" {0,2}", ctr) output.WriteLine("{0,12}{1,15:MMM}", hc.GetDaysInMonth(hc.GetYear(startOfMonth), hc.GetMonth(startOfMonth)), startOfMonth) startOfMonth = hc.AddMonths(startOfMonth, 1) Next output.Close() End Sub Private Function GetCalendarName(cal As Calendar) As String Return cal.ToString().Replace("System.Globalization.", "").Replace("Cal", " Cal") End Function End Module ' The example displays the following output: ' Hebrew Calendar Information: ' ' Start Date: ז' טבת שמ"ג 00:00:00 ' (01/01/1583 00:00:00 Gregorian) ' ' End Date: כ"ט אלול תתקצ"ט 23:59:59 ' (29/09/2239 23:59:59 Gregorian) ' ' Days in the Year 5772: 354 ' ' Days in Each Month of 5772: ' ' Month Days Month Name ' 1 30 תשרי ' 2 29 חשון ' 3 30 כסלו ' 4 29 טבת ' 5 30 שבט ' 6 29 אדר ' 7 30 ניסן ' 8 29 אייר ' 9 30 סיון ' 10 29 תמוז ' 11 30 אב ' 12 29 אלול
Available since 10
.NET Framework
Available since 1.1
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.







The example instantiates a HebrewCalendar object and makes it the current calendar of a Hebrew (Israel) CultureInfo object. It then makes Hebrew (Israel) the current thread culture. This causes the common language runtime to interpret all dates and times in relation to the Hebrew calendar.