The class implements methods to handle the fixed date value from the "Calendrical Calculations" books.

For implementing the Calendar classes I used the algorithms from the book "Calendrical Calculations" by Nachum Dershowitz and Edward M. Rheingold, second reprint 1998. Trying to prevent the introduction of new bugs, I implemented their algorithms in the N:CalendricalCalculations namespace and wrapped it in the calendar classes.

The fixed day number is also known as R.D. - rata die. Midnight at the onset of Monday, January 1, year 1 (Gregorian) is R.D. 1.

Here are all my references:

[1] Nachum Dershowitz and Edward M. Rheingold: "Calendrical Calculations"; Cambridge University Press; second reprint 1998. [2] P. Kenneth Seidelmann (ed.): "Explanatory Supplement to the Astronomical Almanac"; University Science Books, Sausalito; 1992 [3] F. Richard Stephenson: "Historical Eclipses and Earth Rotation"; Cambridge University Press; 1997
Esempio n. 1
0
        /// <summary>
        /// Overriden. Gets the day of the week from the specified date.
        /// </summary>
        /// <param name="time">The
        /// <see cref="T:System.DateTime"/> that specifies a
        /// date.
        /// </param>
        /// <returns>An integer giving the day of months, starting with 1.
        /// </returns>
        /// <exception cref="T:System.ArgumentOutOfRangeException">
        /// The exception is thrown if the
        /// <see cref="T:System.DateTime"/> parameter is not in the
        /// supported range of the Hijri calendar.
        /// </exception>
        public override DayOfWeek GetDayOfWeek(DateTime time)
        {
            int rd = M_FromDateTime(time);

            M_CheckFixedHijri("time", rd);
            return((DayOfWeek)CCFixed.day_of_week(rd));
        }
Esempio n. 2
0
        /// <summary>Calculates on which day of the week a specified date occurs.</summary>
        /// <returns>A <see cref="T:System.DayOfWeek" /> value that represents the day of the week specified by the <paramref name="time" /> parameter.</returns>
        /// <param name="time">The <see cref="T:System.DateTime" /> to read. The <see cref="T:System.Globalization.UmAlQuraCalendar" /> class supports only dates from 04/30/1900 00.00.00 (Gregorian date) through 05/13/2029 23:59:59 (Gregorian date).</param>
        /// <exception cref="T:System.ArgumentOutOfRangeException">
        ///   <paramref name="time" /> is outside the range supported by this calendar. </exception>
        public override DayOfWeek GetDayOfWeek(DateTime time)
        {
            int num = this.M_FromDateTime(time);

            this.M_CheckFixedHijri("time", num);
            return(CCFixed.day_of_week(num));
        }
Esempio n. 3
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>
        /// <exception cref="T:System.ArgumentOutOfRangeException">
        /// The exception is thrown if the
        /// <see cref="T:System.DateTime"/> parameter is not in the years
        /// between 5343 A.M. and 6000 A.M., inclusive.
        /// </exception>
        public override int GetYear(DateTime time)
        {
            M_CheckDateTime(time);
            int rd = CCFixed.FromDateTime(time);

            return(CCHebrewCalendar.year_from_fixed(rd));
        }
Esempio n. 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);
            int era;

            return(M_EraHandler.EraYear(out era, rd));
        }
Esempio n. 5
0
        /// <summary>
        /// Overriden. Gets the day of the month from
        /// <paramref name="time"/>.
        /// </summary>
        /// <param name="time">The
        /// <see cref="T:System.DateTime"/> that specifies a
        /// date.
        /// </param>
        /// <returns>An integer giving the day of months, starting with 1.
        /// </returns>
        /// <exception cref="T:System.ArgumentOutOfRangeException">
        /// The exception is thrown if the
        /// <see cref="T:System.DateTime"/> parameter is not in the years
        /// between 5343 A.M. and 6000 A.M., inclusive.
        /// </exception>
        public override int GetDayOfMonth(DateTime time)
        {
            M_CheckDateTime(time);
            int rd = CCFixed.FromDateTime(time);

            return(CCHebrewCalendar.day_from_fixed(rd));
        }
        /// <summary>Returns the day of the week in the specified <see cref="T:System.DateTime" />.</summary>
        /// <returns>A <see cref="T:System.DayOfWeek" /> value that represents the day of the week in the specified <see cref="T:System.DateTime" />.</returns>
        /// <param name="time">The <see cref="T:System.DateTime" /> to read. </param>
        public override DayOfWeek GetDayOfWeek(DateTime time)
        {
            this.M_CheckDateTime(time);
            int date = CCFixed.FromDateTime(time);

            return(CCFixed.day_of_week(date));
        }
Esempio n. 7
0
        /// <summary>
        /// Overriden. Gets the day of the week from the specified date.
        /// </summary>
        /// <param name="time">The
        /// <see cref="T:System.DateTime"/> that specifies a
        /// date.
        /// </param>
        /// <returns>An integer giving the day of months, starting with 1.
        /// </returns>
        /// <exception cref="T:System.ArgumentOutOfRangeException">
        /// The exception is thrown if the
        /// <see cref="T:System.DateTime"/> parameter is not in the years
        /// between 5343 A.M. and 6000 A.M., inclusive.
        /// </exception>
        public override DayOfWeek GetDayOfWeek(DateTime time)
        {
            M_CheckDateTime(time);
            int rd = CCFixed.FromDateTime(time);

            return((DayOfWeek)CCFixed.day_of_week(rd));
        }
Esempio n. 8
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>
	/// <exception cref="T:System.ArgumentOutOfRangeException">
	/// The exception is thrown if the
	/// <see cref="T:System.DateTime"/> parameter is outside all
	/// supported eras.
	/// </exception>
	public override int GetYear(DateTime time) {
		// M_CheckDateTime not needed, because EraYeat does the
		// right thing.
		int rd = CCFixed.FromDateTime(time);
		int era;
		return M_EraHandler.EraYear(out era, rd);
	}
Esempio n. 9
0
        /// <summary>Returns the year in the specified <see cref="T:System.DateTime" />.</summary>
        /// <returns>An integer that represents the year in the specified <see cref="T:System.DateTime" />.</returns>
        /// <param name="time">The <see cref="T:System.DateTime" /> to read. </param>
        public override int GetYear(DateTime time)
        {
            int date = CCFixed.FromDateTime(time);
            int num;

            return(KoreanCalendar.M_EraHandler.EraYear(out num, date));
        }
Esempio n. 10
0
        /// <summary>Returns the year in the specified <see cref="T:System.DateTime" /> value.</summary>
        /// <returns>An integer that represents the year in the specified <see cref="T:System.DateTime" /> value.</returns>
        /// <param name="time">The <see cref="T:System.DateTime" /> to read. </param>
        /// <exception cref="T:System.ArgumentOutOfRangeException">
        ///   <paramref name="time" /> is outside the range supported by the current <see cref="T:System.Globalization.HebrewCalendar" /> object. </exception>
        public override int GetYear(DateTime time)
        {
            this.M_CheckDateTime(time);
            int date = CCFixed.FromDateTime(time);

            return(CCHebrewCalendar.year_from_fixed(date));
        }
        /// <summary>Returns a <see cref="T:System.DateTime" /> that is set to the specified date, time, and era.</summary>
        /// <returns>A <see cref="T:System.DateTime" /> that is set to the specified date and time in the current era.</returns>
        /// <param name="year">An integer from 1 through 9378 that represents the year. </param>
        /// <param name="month">An integer from 1 through 12 that represents the month. </param>
        /// <param name="day">An integer from 1 through 31 that represents the day. </param>
        /// <param name="hour">An integer from 0 through 23 that represents the hour. </param>
        /// <param name="minute">An integer from 0 through 59 that represents the minute. </param>
        /// <param name="second">An integer from 0 through 59 that represents the second. </param>
        /// <param name="millisecond">An integer from 0 through 999 that represents the millisecond. </param>
        /// <param name="era">An integer from 0 through 1 that represents the era. </param>
        /// <exception cref="T:System.ArgumentOutOfRangeException">
        ///   <paramref name="year" />, <paramref name="month" />, <paramref name="day" />, <paramref name="hour" />, <paramref name="minute" />, <paramref name="second" />, <paramref name="millisecond" />, or <paramref name="era" /> is outside the range supported by this calendar.</exception>
        public override DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era)
        {
            this.M_CheckYMDE(year, month, day, ref era);
            base.M_CheckHMSM(hour, minute, second, millisecond);
            int date = this.fixed_from_dmy(day, month, year);

            return(CCFixed.ToDateTime(date, hour, minute, second, (double)millisecond));
        }
Esempio n. 12
0
        /// <summary>Returns the era in the specified <see cref="T:System.DateTime" />.</summary>
        /// <returns>An integer that represents the era in the specified <see cref="T:System.DateTime" />.</returns>
        /// <param name="time">The <see cref="T:System.DateTime" /> to read. </param>
        public override int GetEra(DateTime time)
        {
            int date = CCFixed.FromDateTime(time);
            int result;

            KoreanCalendar.M_EraHandler.EraYear(out result, date);
            return(result);
        }
Esempio n. 13
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);
        }
Esempio n. 14
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 override int GetEra(DateTime time)
        {
            int date = CCFixed.FromDateTime(time);
            int result;

            ChineseLunisolarCalendar.era_handler.EraYear(out result, date);
            return(result);
        }
Esempio n. 16
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);
        }
Esempio n. 17
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>
        /// <exception cref="T:System.ArgumentOutOfRangeException">
        /// The exception is thrown if the
        /// <see cref="T:System.DateTime"/> parameter is not in the years
        /// between 1 A.P. and 9999 C.E., inclusive.
        /// </exception>
        public override int GetDayOfYear(DateTime time)
        {
            M_CheckDateTime(time);
            int rd    = CCFixed.FromDateTime(time);
            int year  = year_from_fixed(rd);
            int rd1_1 = fixed_from_dmy(1, 1, year);

            return(rd - rd1_1 + 1);
        }
Esempio n. 18
0
        /// <summary>
        /// Overridden. Gives the number of the month of the specified
        /// date.
        /// </summary>
        /// <param name="time">The
        /// <see cref="T:System.DateTime"/> that specifies a
        /// date.
        /// </param>
        /// <returns>An integer representing the month,
        /// starting with 1.</returns>
        /// <exception cref="T:System.ArgumentOutOfRangeException">
        /// The exception is thrown if the
        /// <see cref="T:System.DateTime"/> parameter is not in the years
        /// between 5343 A.M. and 6000 A.M., inclusive.
        /// </exception>
        public override int GetMonth(DateTime time)
        {
            M_CheckDateTime(time);
            int rd = CCFixed.FromDateTime(time);
            int ccmonth, year;

            CCHebrewCalendar.my_from_fixed(out ccmonth, out year, rd);
            return(M_Month(ccmonth, year));
        }
Esempio n. 19
0
        /// <summary>
        /// Overridden. Gives the number of the month of the specified
        /// date.
        /// </summary>
        /// <param name="time">The
        /// <see cref="T:System.DateTime"/> that specifies a
        /// date.
        /// </param>
        /// <returns>An integer representing the month,
        /// starting with 1.</returns>
        /// <exception cref="T:System.ArgumentOutOfRangeException">
        /// The exception is thrown if the
        /// <see cref="T:System.DateTime"/> parameter is not in the years
        /// between 1 A.P. and 9999 C.E., inclusive.
        /// </exception>
        public override int GetMonth(DateTime time)
        {
            M_CheckDateTime(time);
            int rd = CCFixed.FromDateTime(time);
            int month, year;

            my_from_fixed(out month, out year, rd);
            return(month);
        }
        public void CheckDateTime(DateTime time)
        {
            int date = CCFixed.FromDateTime(time);

            if (!this.ValidDate(date))
            {
                throw new ArgumentOutOfRangeException("time", "Time value was out of era range.");
            }
        }
Esempio n. 21
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>
        /// <exception cref="T:System.ArgumentOutOfRangeException">
        /// The exception is thrown if the
        /// <see cref="T:System.DateTime"/> parameter is not in the years
        /// between 5343 A.M. and 6000 A.M., inclusive.
        /// </exception>
        public override int GetDayOfYear(DateTime time)
        {
            M_CheckDateTime(time);
            int rd    = CCFixed.FromDateTime(time);
            int year  = CCHebrewCalendar.year_from_fixed(rd);
            int rd1_7 = CCHebrewCalendar.fixed_from_dmy(1, 7, year);

            return(rd - rd1_7 + 1);
        }
Esempio n. 22
0
        /// <summary>Returns the day of the year in the specified <see cref="T:System.DateTime" />.</summary>
        /// <returns>An integer from 1 to 385 that represents the day of the year in the specified <see cref="T:System.DateTime" />.</returns>
        /// <param name="time">The <see cref="T:System.DateTime" /> to read. </param>
        /// <exception cref="T:System.ArgumentOutOfRangeException">
        ///   <paramref name="time" /> is earlier than September 17, 1583 in the Gregorian calendar, or greater than <see cref="P:System.Globalization.HebrewCalendar.MaxSupportedDateTime" />. </exception>
        public override int GetDayOfYear(DateTime time)
        {
            this.M_CheckDateTime(time);
            int num  = CCFixed.FromDateTime(time);
            int year = CCHebrewCalendar.year_from_fixed(num);
            int num2 = CCHebrewCalendar.fixed_from_dmy(1, 7, year);

            return(num - num2 + 1);
        }
Esempio n. 23
0
        /// <summary>
        /// Overrideden. Adds months to a given date.
        /// </summary>
        /// <param name="time">The
        /// <see cref="T:System.DateTime"/> to which to add
        /// months.
        /// </param>
        /// <param name="months">The number of months to add.</param>
        /// <returns>A new <see cref="T:System.DateTime"/> value, that
        /// results from adding <paramref name="months"/> to the specified
        /// DateTime.</returns>
        /// <exception cref="T:System.ArgumentOutOfRangeException">
        /// The exception is thrown if the
        /// <see cref="T:System.DateTime"/> return value is not in the years
        /// between 5343 A.M. and 6000 A.M., inclusive.
        /// </exception>
        public override DateTime AddMonths(DateTime time, int months)
        {
            int      y, m, d;
            DateTime t;

            if (months == 0)
            {
                t = time;
            }
            else
            {
                int rd = CCFixed.FromDateTime(time);
                CCHebrewCalendar.dmy_from_fixed(
                    out d, out m, out y, rd);
                m = M_Month(m, y);
                if (months < 0)
                {
                    while (months < 0)
                    {
                        if (m + months > 0)
                        {
                            m     += months;
                            months = 0;
                        }
                        else
                        {
                            months += m;
                            y      -= 1;
                            m       = GetMonthsInYear(y);
                        }
                    }
                }
                else
                {
                    while (months > 0)
                    {
                        int my = GetMonthsInYear(y);
                        if (m + months <= my)
                        {
                            m     += months;
                            months = 0;
                        }
                        else
                        {
                            months -= my - m + 1;
                            m       = 1;
                            y      += 1;
                        }
                    }
                }
                t = ToDateTime(y, m, d, 0, 0, 0, 0);
                t = t.Add(time.TimeOfDay);
            }
            M_CheckDateTime(t);
            return(t);
        }
Esempio n. 24
0
        /// <summary>Returns a <see cref="T:System.DateTime" /> that is the specified number of months away from the specified <see cref="T:System.DateTime" />.</summary>
        /// <returns>The <see cref="T:System.DateTime" /> that results from adding the specified number of months to the specified <see cref="T:System.DateTime" />.</returns>
        /// <param name="time">The <see cref="T:System.DateTime" /> to which to add <paramref name="months" />. </param>
        /// <param name="months">The number of months to add. </param>
        /// <exception cref="T:System.ArgumentException">The resulting <see cref="T:System.DateTime" /> is outside the supported range. </exception>
        /// <exception cref="T:System.ArgumentOutOfRangeException">
        ///   <paramref name="months" /> is less than -120,000 or greater than 120,000. </exception>
        public override DateTime AddMonths(DateTime time, int months)
        {
            DateTime dateTime;

            if (months == 0)
            {
                dateTime = time;
            }
            else
            {
                int date = CCFixed.FromDateTime(time);
                int day;
                int num;
                int num2;
                CCHebrewCalendar.dmy_from_fixed(out day, out num, out num2, date);
                num = this.M_Month(num, num2);
                if (months < 0)
                {
                    while (months < 0)
                    {
                        if (num + months > 0)
                        {
                            num   += months;
                            months = 0;
                        }
                        else
                        {
                            months += num;
                            num2--;
                            num = this.GetMonthsInYear(num2);
                        }
                    }
                }
                else
                {
                    while (months > 0)
                    {
                        int monthsInYear = this.GetMonthsInYear(num2);
                        if (num + months <= monthsInYear)
                        {
                            num   += months;
                            months = 0;
                        }
                        else
                        {
                            months -= monthsInYear - num + 1;
                            num     = 1;
                            num2++;
                        }
                    }
                }
                dateTime = this.ToDateTime(num2, num, day, 0, 0, 0, 0).Add(time.TimeOfDay);
            }
            this.M_CheckDateTime(dateTime);
            return(dateTime);
        }
        /// <summary>Returns the month in the specified <see cref="T:System.DateTime" /> object.</summary>
        /// <returns>An integer from 1 through 12 that represents the month in the specified <see cref="T:System.DateTime" /> object.</returns>
        /// <param name="time">The <see cref="T:System.DateTime" /> to read. </param>
        /// <exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="time" /> parameter represents a date less than <see cref="P:System.Globalization.PersianCalendar.MinSupportedDateTime" /> or greater than <see cref="P:System.Globalization.PersianCalendar.MaxSupportedDateTime" />.</exception>
        public override int GetMonth(DateTime time)
        {
            this.M_CheckDateTime(time);
            int date = CCFixed.FromDateTime(time);
            int result;
            int num;

            this.my_from_fixed(out result, out num, date);
            return(result);
        }
Esempio n. 26
0
        /// <summary>
        /// Overriden. Gets the day of the month from
        /// <paramref name="time"/>.
        /// </summary>
        /// <param name="time">The
        /// <see cref="T:System.DateTime"/> that specifies a
        /// date.
        /// </param>
        /// <returns>An integer giving the day of months, starting with 1.
        /// </returns>
        /// <exception cref="T:System.ArgumentOutOfRangeException">
        /// The exception is thrown if the
        /// <see cref="T:System.DateTime"/> parameter is not in the years
        /// between 1 A.P. and 9999 C.E., inclusive.
        /// </exception>
        public override int GetDayOfMonth(DateTime time)
        {
            int day, month, year;

            M_CheckDateTime(time);
            int rd = CCFixed.FromDateTime(time);

            dmy_from_fixed(out day, out month, out year, rd);
            return(day);
        }
Esempio n. 27
0
        /// <summary>Returns the month in the specified <see cref="T:System.DateTime" />.</summary>
        /// <returns>An integer from 1 to 13 that represents the month in the specified <see cref="T:System.DateTime" />.</returns>
        /// <param name="time">The <see cref="T:System.DateTime" /> to read. </param>
        /// <exception cref="T:System.ArgumentOutOfRangeException">
        ///   <paramref name="time" /> is less than <see cref="P:System.Globalization.HebrewCalendar.MinSupportedDateTime" /> or greater than <see cref="P:System.Globalization.HebrewCalendar.MaxSupportedDateTime" />.</exception>
        public override int GetMonth(DateTime time)
        {
            this.M_CheckDateTime(time);
            int date = CCFixed.FromDateTime(time);
            int ccmonth;
            int year;

            CCHebrewCalendar.my_from_fixed(out ccmonth, out year, date);
            return(this.M_Month(ccmonth, year));
        }
Esempio n. 28
0
        /// <summary>
        /// Overridden. Creates the
        /// <see cref="T:System.DateTime"/> from the parameters.
        /// </summary>
        /// <param name="year">An integer that gives the year in the
        /// <paramref name="era"/>.
        /// </param>
        /// <param name="month">An integer that specifies the month.
        /// </param>
        /// <param name="day">An integer that specifies the day.
        /// </param>
        /// <param name="hour">An integer that specifies the hour.
        /// </param>
        /// <param name="minute">An integer that specifies the minute.
        /// </param>
        /// <param name="second">An integer that gives the second.
        /// </param>
        /// <param name="milliseconds">An integer that gives the
        /// milliseconds.
        /// </param>
        /// <param name="era">An integer that specifies the era.
        /// </param>
        /// <returns>
        /// <see cref="T:system.DateTime"/> representig the date and time.
        /// </returns>
        /// <exception cref="T:System.ArgumentOutOfRangeException">
        /// The exception is thrown, if at least one of the parameters
        /// is out of range.
        /// </exception>
        public override DateTime ToDateTime(int year, int month, int day,
                                            int hour, int minute, int second, int milliseconds,
                                            int era)
        {
            M_CheckYMDE(year, month, day, ref era);
            M_CheckHMSM(hour, minute, second, milliseconds);
            int rd = CCJulianCalendar.fixed_from_dmy(day, month, year);

            return(CCFixed.ToDateTime(rd,
                                      hour, minute, second, milliseconds));
        }
Esempio n. 29
0
        /// <summary>Returns a <see cref="T:System.DateTime" /> that is the specified number of years away from the specified <see cref="T:System.DateTime" />.</summary>
        /// <returns>The <see cref="T:System.DateTime" /> that results from adding the specified number of years to the specified <see cref="T:System.DateTime" />.</returns>
        /// <param name="time">The <see cref="T:System.DateTime" /> to which to add years. </param>
        /// <param name="years">The number of years to add. </param>
        /// <exception cref="T:System.ArgumentException">The resulting <see cref="T:System.DateTime" /> is outside the supported range. </exception>
        public override DateTime AddYears(DateTime time, int years)
        {
            int date = CCFixed.FromDateTime(time);
            int day;
            int month;
            int num;

            CCJulianCalendar.dmy_from_fixed(out day, out month, out num, date);
            num += years;
            date = CCJulianCalendar.fixed_from_dmy(day, month, num);
            return(CCFixed.ToDateTime(date).Add(time.TimeOfDay));
        }
        /// <summary>
        /// Overridden. Creates the
        /// <see cref="T:System.DateTime"/> from the parameters.
        /// </summary>
        /// <param name="year">An integer that gives the year in the
        /// <paramref name="era"/>.
        /// </param>
        /// <param name="month">An integer that specifies the month.
        /// </param>
        /// <param name="day">An integer that specifies the day.
        /// </param>
        /// <param name="hour">An integer that specifies the hour.
        /// </param>
        /// <param name="minute">An integer that specifies the minute.
        /// </param>
        /// <param name="second">An integer that gives the second.
        /// </param>
        /// <param name="milliseconds">An integer that gives the
        /// milliseconds.
        /// </param>
        /// <param name="era">An integer that specifies the era.
        /// </param>
        /// <returns>A
        /// <see cref="T:system.DateTime"/> representig the date and time.
        /// </returns>
        /// <exception cref="T:System.ArgumentOutOfRangeException">
        /// The exception is thrown, if at least one of the parameters
        /// is out of range.
        /// </exception>
        public override DateTime ToDateTime(int year, int month, int day,
                                            int hour, int minute, int second, int millisecond,
                                            int era)
        {
            M_CheckYMDE(year, month, day, ref era);
            M_CheckHMSM(hour, minute, second, millisecond);
            int ccm = M_CCMonth(month, year);
            int rd  = CCHebrewCalendar.fixed_from_dmy(day, ccm, year);

            return(CCFixed.ToDateTime(rd,
                                      hour, minute, second, millisecond));
        }