dmy_from_fixed() public static method

The method computes the Gregorian year, month, and day from a fixed day number.
public static dmy_from_fixed ( int &day, int &month, int &year, int date ) : void
day int The output value returning the day of the /// month. ///
month int The output value giving the Gregorian month. ///
year int The output value giving the Gregorian year. ///
date int An integer value specifying the fixed day /// number.
return void
Example #1
0
        public static int day_from_fixed(int date)
        {
            int result;
            int num;
            int num2;

            CCGregorianCalendar.dmy_from_fixed(out result, out num, out num2, date);
            return(result);
        }
Example #2
0
        public static DateTime AddYears(DateTime time, int years)
        {
            int date = CCFixed.FromDateTime(time);
            int num;
            int month;
            int num2;

            CCGregorianCalendar.dmy_from_fixed(out num, out month, out num2, date);
            num2 += years;
            int daysInMonth = CCGregorianCalendar.GetDaysInMonth(num2, month);

            if (num > daysInMonth)
            {
                num = daysInMonth;
            }
            date = CCGregorianCalendar.fixed_from_dmy(num, month, num2);
            return(CCFixed.ToDateTime(date).Add(time.TimeOfDay));
        }
Example #3
0
        public static DateTime AddMonths(DateTime time, int months)
        {
            int date = CCFixed.FromDateTime(time);
            int num;
            int num2;
            int num3;

            CCGregorianCalendar.dmy_from_fixed(out num, out num2, out num3, date);
            num2 += months;
            num3 += CCMath.div_mod(out num2, num2, 12);
            int daysInMonth = CCGregorianCalendar.GetDaysInMonth(num3, num2);

            if (num > daysInMonth)
            {
                num = daysInMonth;
            }
            date = CCGregorianCalendar.fixed_from_dmy(num, num2, num3);
            return(CCFixed.ToDateTime(date).Add(time.TimeOfDay));
        }