year_from_fixed() public static method

The method computes the Julian 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
        /// <summary>
        /// Overridden. Gives the number of the day in the year.
        /// </summary>
        /// <param name="time">The
        /// <see cref="T:System.DateTime"/> that specifies a
        /// date.
        /// </param>
        /// <returns>An integer representing the day of the year,
        /// starting with 1.</returns>
        public override int GetDayOfYear(DateTime time)
        {
            int rd    = CCFixed.FromDateTime(time);
            int year  = CCJulianCalendar.year_from_fixed(rd);
            int rd1_1 = CCJulianCalendar.fixed_from_dmy(1, 1, year);

            return(rd - rd1_1 + 1);
        }
Example #2
0
        /// <summary>Returns the day of the year in the specified <see cref="T:System.DateTime" />.</summary>
        /// <returns>An integer from 1 to 366 that represents the day of the year in <paramref name="time" />.</returns>
        /// <param name="time">The <see cref="T:System.DateTime" /> to read. </param>
        public override int GetDayOfYear(DateTime time)
        {
            int num  = CCFixed.FromDateTime(time);
            int year = CCJulianCalendar.year_from_fixed(num);
            int num2 = CCJulianCalendar.fixed_from_dmy(1, 1, year);

            return(num - num2 + 1);
        }
        public static void my_from_fixed(out int month, out int year, int date)
        {
            year = CCJulianCalendar.year_from_fixed(date);
            int num = date - CCJulianCalendar.fixed_from_dmy(1, 1, year);
            int num2;

            if (date < CCJulianCalendar.fixed_from_dmy(1, 3, year))
            {
                num2 = 0;
            }
            else if (CCJulianCalendar.is_leap_year(year))
            {
                num2 = 1;
            }
            else
            {
                num2 = 2;
            }
            month = CCMath.div(12 * (num + num2) + 373, 367);
        }
Example #4
0
        /// <summary>
        /// Overridden. Gives the number of the year of the specified
        /// date.
        /// </summary>
        /// <param name="time">The
        /// <see cref="T:System.DateTime"/> that specifies a
        /// date.
        /// </param>
        /// <returns>An integer representing the year,
        /// starting with 1.</returns>
        public override int GetYear(DateTime time)
        {
            int rd = CCFixed.FromDateTime(time);

            return(CCJulianCalendar.year_from_fixed(rd));
        }