year_from_fixed() public static method

The method computes the Gregorian year from a fixed day number.
public static year_from_fixed ( int date ) : int
date int The fixed day number. ///
return int
Example #1
0
        public static int GetDayOfYear(DateTime time)
        {
            int num  = CCFixed.FromDateTime(time);
            int year = CCGregorianCalendar.year_from_fixed(num);
            int num2 = CCGregorianCalendar.fixed_from_dmy(1, 1, year);

            return(num - num2 + 1);
        }
            public int EraYear(out int era, int date)
            {
                if (!this.Covers(date))
                {
                    throw new ArgumentOutOfRangeException("date", "Time was out of Era range.");
                }
                int num = CCGregorianCalendar.year_from_fixed(date);

                era = this._nr;
                return(num - this._gregorianYearStart + 1);
            }
            public Era(int nr, int start, int end)
            {
                if (nr == 0)
                {
                    throw new ArgumentException("Era number shouldn't be zero.");
                }
                this._nr = nr;
                if (start > end)
                {
                    throw new ArgumentException("Era should start before end.");
                }
                this._start = start;
                this._end   = end;
                this._gregorianYearStart = CCGregorianCalendar.year_from_fixed(this._start);
                int num = CCGregorianCalendar.year_from_fixed(this._end);

                this._maxYear = num - this._gregorianYearStart + 1;
            }
Example #4
0
        public static void my_from_fixed(out int month, out int year, int date)
        {
            year = CCGregorianCalendar.year_from_fixed(date);
            int num = date - CCGregorianCalendar.fixed_from_dmy(1, 1, year);
            int num2;

            if (date < CCGregorianCalendar.fixed_from_dmy(1, 3, year))
            {
                num2 = 0;
            }
            else if (CCGregorianCalendar.is_leap_year(year))
            {
                num2 = 1;
            }
            else
            {
                num2 = 2;
            }
            month = CCMath.div(12 * (num + num2) + 373, 367);
        }
Example #5
0
 public static int GetYear(DateTime time)
 {
     return(CCGregorianCalendar.year_from_fixed(CCFixed.FromDateTime(time)));
 }