/// <summary> /// Sets the date according to the Hebrew Calendar /// </summary> /// <param name="year">Number of years since Creation</param> /// <param name="month">Month of the year</param> /// <param name="day">Day of the month</param> public JewishDate(int year, int month, int day) { HebrewCalendar hebCal = new HebrewCalendar(); GregDate = hebCal.ToDateTime(year, month, day, 0, 0, 0, 0); Year = year; Month = month; Day = day; DayOfWeek = hebCal.GetDayOfWeek(GregDate); DayOfYear = hebCal.GetDayOfYear(GregDate); }
/// <summary> /// Sets the date according to the Gregorian Calendar /// </summary> /// <param name="date">The Gregorian date</param> public JewishDate(DateTime date) { GregDate = date; HebrewCalendar hebCal = new HebrewCalendar(); Year = hebCal.GetYear(date); Month = hebCal.GetMonth(date); Day = hebCal.GetDayOfMonth(date); DayOfWeek = hebCal.GetDayOfWeek(GregDate); DayOfYear = hebCal.GetDayOfYear(GregDate); }
/// <summary> /// Returns what day of the week the first day of Pesach falls on, used to calculate the parshios /// </summary> /// <param name="Date">A date within the respective year, doesn't have to be Pesach</param> /// <returns>The day of the week that first day of Pesach falls on</returns> public static DayOfWeek GetPesachDayOfWeek(JewishDate Date) { HebrewCalendar hebCal = new HebrewCalendar(); return(hebCal.GetDayOfWeek(new JewishDate(Date.Year, IsLeapYear(Date) ? 8 : 7, 15))); }