GetMonth() public method

public GetMonth ( System.DateTime time ) : int
time System.DateTime
return int
Exemplo n.º 1
0
        public IEnumerable<ComplexZmanimCalendar> GetDaysInHebrewMonth(DateTime yearAndMonth, GeoLocation location)
        {
            Calendar calendar = new HebrewCalendar();
            var daysInMonth = calendar.GetDaysInMonth(calendar.GetYear(yearAndMonth), calendar.GetMonth(yearAndMonth));

            for (int i = 0; i < daysInMonth; i++)
            {
                var zmanimCalendar = new ComplexZmanimCalendar(location);
                zmanimCalendar.DateWithLocation.Date = new DateTime(yearAndMonth.Year, yearAndMonth.Month, i + 1);
                yield return zmanimCalendar;
            }
        }
Exemplo n.º 2
0
        public Dates()
        {
            hebCal = new HebrewCalendar();
            DateTime dt = DateTime.Now;
            NextGregMonth = 0;
            CurrentGregDay = dt.Day;
            CurrentGregMonth = dt.Month;
            CurrentGregYear = dt.Year;
            GetGregDateScope();

            NextJewishMonth = 0;
            //NextJewishMonthScope = 0;
            CurrentJewishDay = hebCal.GetDayOfMonth(dt);
            CurrentJewishMonth = hebCal.GetMonth(dt);
            CurrentJewishYear = hebCal.GetYear(dt);
            GetJewishDaysScope();
        }
Exemplo n.º 3
0
 /// <summary>
 /// Converts from Microsoft's Hebrew month numbering system to usual Hebrew month numbering system
 /// The Hebrew calendar begins on the first day of the seventh month
 /// To illustrate this problem:
 /// Microsoft says since Tishrei is the first month of the new year it is number 1
 /// However, Tishrei is normally number 7
 /// </summary>
 /// <param name="d">A DateTime</param>
 /// <returns>The corrected month number</returns>
 public int CorrectedHebrewMonth(DateTime d)
 {
     HebrewCalendar hc = new HebrewCalendar();
     int zeroCountMonth = hc.GetMonth(d) - 1;//having my months be zero count allows for modulo division
     
     if (hc.IsLeapYear(hc.GetYear(d))){
         zeroCountMonth = (zeroCountMonth + 6) % 13;
     }
     else
     {
         zeroCountMonth = (zeroCountMonth + 6) % 12;
     }
     return zeroCountMonth + 1;
 }