System.Globalization.CCJulianCalendar.year_from_fixed C# (CSharp) Method

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
	public static int year_from_fixed(int date) {
		int approx = CCMath.div(4*(date-epoch)+1464, 1461);
		return approx <= 0 ? approx - 1 : approx;
	}

Usage Example

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);
        }
All Usage Examples Of System.Globalization.CCJulianCalendar::year_from_fixed