System.Globalization.CCGregorianCalendar.fixed_from_dmy C# (CSharp) Method

fixed_from_dmy() public static method

The method returns the fixed day number of the given Gregorian date.
public static fixed_from_dmy ( int day, int month, int year ) : int
day int An integer representing the day of the month, /// counting from 1. ///
month int An integer representing the month in the /// Gregorian year. ///
year int An integer representing the Gregorian year. /// Non-positive values are allowed also. ///
return int
	public static int fixed_from_dmy(int day, int month, int year) {
		int k = epoch - 1;
		k += 365 * (year-1);
		k += CCMath.div(year-1, 4);
		k -= CCMath.div(year-1, 100);
		k += CCMath.div(year-1, 400);
		k += CCMath.div(367*month-362, 12);
		if (month > 2) {
			k += is_leap_year(year) ? -1 : -2;
		}

		k += day;

		return k;
	}

Usage Example

Example #1
0
        public static int GetDaysInYear(int year)
        {
            int num  = CCGregorianCalendar.fixed_from_dmy(1, 1, year);
            int num2 = CCGregorianCalendar.fixed_from_dmy(1, 1, year + 1);

            return(num2 - num);
        }
All Usage Examples Of System.Globalization.CCGregorianCalendar::fixed_from_dmy