System.Globalization.CCGregorianCalendar.is_leap_year C# (CSharp) Метод

is_leap_year() публичный статический Метод

The method tells whether the year is a leap year.
public static is_leap_year ( int year ) : bool
year int An integer representing the Gregorian year. ///
Результат bool
	public static bool is_leap_year(int year) {
		if (CCMath.mod(year, 4) != 0)
			return false;
		switch (CCMath.mod(year, 400)) {
			case 100: 
				return false;
			case 200:
				return false;
			case 300:
				return false;
		}
		return true;
	}

Usage Example

Пример #1
0
        public static int fixed_from_dmy(int day, int month, int year)
        {
            int num = 0;

            num += 365 * (year - 1);
            num += CCMath.div(year - 1, 4);
            num -= CCMath.div(year - 1, 100);
            num += CCMath.div(year - 1, 400);
            num += CCMath.div(367 * month - 362, 12);
            if (month > 2)
            {
                num += ((!CCGregorianCalendar.is_leap_year(year)) ? -2 : -1);
            }
            return(num + day);
        }
All Usage Examples Of System.Globalization.CCGregorianCalendar::is_leap_year