IsLeapYear() public method

public IsLeapYear ( int year, int era ) : bool
year int
era int
return bool
コード例 #1
0
        public void IsLeapYear()
        {
            var bcl = new HebrewCalendar();
            var minYear = bcl.GetYear(bcl.MinSupportedDateTime);
            var maxYear = bcl.GetYear(bcl.MaxSupportedDateTime);
            var noda = CalendarSystem.HebrewCivil;

            for (int year = minYear; year <= maxYear; year++)
            {
                Assert.AreEqual(bcl.IsLeapYear(year), noda.IsLeapYear(year));
            }
        }
コード例 #2
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;
 }
コード例 #3
0
        public override string ToString()
        {
            //The following bloc ensures that people die in the past.
            HebrewCalendar hc = new HebrewCalendar();
            DateTime d = DateTime.Today;
            int year = (hc.IsLeapYear(hc.GetYear(d))) ? 5774 : 5773;
            year = CheckPrefernce() ? year : yearH;

            return String.Format("\"{0}\",\"{1}\",\"{2}\",\"{3} {4}\",\"{5}\",\"{6}\",\"{7}\",\"0\"",
                plaqueNum1, plaqueNum2, plaqueNum3, nameF, nameL, dayH, monthH, year);
        }