/// <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 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)); }
/// <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)); }
/// <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)); }
/// <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)); }
/// <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)); }
/// <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); }
/// <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> /// 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); }
public override int GetEra(DateTime time) { int date = CCFixed.FromDateTime(time); int result; ChineseLunisolarCalendar.era_handler.EraYear(out result, date); return(result); }
/// <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); }
/// <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 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); }
/// <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); }
/// <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); }
/// <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); }
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."); } }
/// <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)); }
/// <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); }
/// <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> /// 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); }
/// <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); }
/// <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); }
/// <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)); }
/// <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. Adds years to a given date. /// </summary> /// <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> /// <returns>A new <see cref="T:System.DateTime"/> value, that /// results from adding <paramref name="years"/> to the specified /// DateTime.</returns> public override DateTime AddYears(DateTime time, int years) { int rd = CCFixed.FromDateTime(time); int day, month, year; CCJulianCalendar.dmy_from_fixed( out day, out month, out year, rd); year += years; rd = CCJulianCalendar.fixed_from_dmy(day, month, year); DateTime t = CCFixed.ToDateTime(rd); return(t.Add(time.TimeOfDay)); }
/// <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 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 -120000.-or- <paramref name="months" /> is greater than 120000. </exception> public override DateTime AddMonths(DateTime time, int months) { int date = CCFixed.FromDateTime(time); int day; int num; int num2; CCJulianCalendar.dmy_from_fixed(out day, out num, out num2, date); num += months; num2 += CCMath.div_mod(out num, num, 12); date = CCJulianCalendar.fixed_from_dmy(day, num, num2); return(CCFixed.ToDateTime(date).Add(time.TimeOfDay)); }
/// <summary> /// Overridden. Adds years to a given date. /// </summary> /// <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> /// <returns>A new <see cref="T:System.DateTime"/> value, that /// results from adding <paramref name="years"/> 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 1 A.P. and 9999 C.E., inclusive. /// </exception> public override DateTime AddYears(DateTime time, int years) { int rd = CCFixed.FromDateTime(time); int day, month, year; dmy_from_fixed(out day, out month, out year, rd); year += years; rd = fixed_from_dmy(day, month, year); DateTime t = CCFixed.ToDateTime(rd); t = t.Add(time.TimeOfDay); M_CheckDateTime(t); return(t); }
/// <summary> /// Overridden. 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> public override DateTime AddMonths(DateTime time, int months) { int rd = CCFixed.FromDateTime(time); int day, month, year; CCJulianCalendar.dmy_from_fixed( out day, out month, out year, rd); month += months; year += CCMath.div_mod(out month, month, 12); rd = CCJulianCalendar.fixed_from_dmy(day, month, year); DateTime t = CCFixed.ToDateTime(rd); return(t.Add(time.TimeOfDay)); }
/// <summary>Returns a <see cref="T:System.DateTime" /> that is offset the specified number of years from the specified <see cref="T:System.DateTime" /> object.</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" /> object.</returns> /// <param name="time">The <see cref="T:System.DateTime" /> to which to add years. </param> /// <param name="years">The positive or negative number of years 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="years" /> is less than -10,000 or greater than 10,000. </exception> public override DateTime AddYears(DateTime time, int years) { int date = CCFixed.FromDateTime(time); int day; int month; int num; this.dmy_from_fixed(out day, out month, out num, date); num += years; date = this.fixed_from_dmy(day, month, num); DateTime dateTime = CCFixed.ToDateTime(date).Add(time.TimeOfDay); this.M_CheckDateTime(dateTime); return(dateTime); }