System.Globalization.CCGregorianEraHandler.EraYear C# (CSharp) Method

EraYear() public method

This function returns the year of the era and sets the era in an output parameter.
/// The exception is thrown if the fixed day number is outside of the /// time spans of all eras. ///
public EraYear ( int &era, int date ) : int
era int An output parameter returning the /// era number. ///
date int An integer giving the fixed day /// number. ///
return int
	public int EraYear(out int era, int date)
	{
		IList list = _Eras.GetValueList();

		foreach (Era e in list) {
			if (e.Covers(date))
				return e.EraYear(out era, date);
		}

		throw new System.ArgumentOutOfRangeException("date",
			"Time value was out of era range.");
	}

Usage Example

Example #1
0
        /// <summary>
        /// Overridden. Gives the era of the specified date.
        /// </summary>
        /// <param name="time">The
        /// <see cref="T:System.DateTime"/> that specifies a
        /// date.
        /// </param>
        /// <returns>An integer representing the era of the calendar.
        /// </returns>
        public override int GetEra(DateTime time)
        {
            int rd = CCFixed.FromDateTime(time);
            int era;

            M_EraHandler.EraYear(out era, rd);
            return(era);
        }
All Usage Examples Of System.Globalization.CCGregorianEraHandler::EraYear