IsLeapDay() public method

Determines whether the Date specified by the year, month, day, and era parameters is a leap day.
In the Persian calendar leap years are applied every 4 or 5 years according to a certain pattern that iterates in a 2820-year cycle. A common year has 365 days and a leap year has 366 days. A leap day is a day that occurs only in a leap year. In the Persian calendar, the 30th day of Esfand (month 12) is the only leap day.
public IsLeapDay ( int year, int month, int day, int era ) : bool
year int An integer that represents the year.
month int An integer that represents the month.
day int An integer that represents the day.
era int An integer that represents the era.
return bool
Exemplo n.º 1
0
        private void CheckDay(int YearNo, int MonthNo, int DayNo)
        {
            if (MonthNo < 6 && DayNo > 31)
            {
                throw new InvalidPersianDateException(FALocalizeManager.Instance.GetLocalizer().GetLocalizedString(StringID.PersianDate_InvalidDay), DayNo);
            }

            if (MonthNo > 6 && DayNo > 30)
            {
                throw new InvalidPersianDateException(FALocalizeManager.Instance.GetLocalizer().GetLocalizedString(StringID.PersianDate_InvalidDay), DayNo);
            }

            if (MonthNo == 12 && DayNo > 29)
            {
                if (!pc.IsLeapDay(YearNo, MonthNo, DayNo) || DayNo > 30)
                {
                    throw new InvalidPersianDateException(FALocalizeManager.Instance.GetLocalizer().GetLocalizedString(StringID.PersianDate_InvalidDay), DayNo);
                }
            }
        }