public static dmy_from_fixed ( int &day, int &month, int &year, int date ) : void | ||
day | int | The output value returning the day of the /// month. /// |
month | int | The output value giving the Islamic month. /// |
year | int | The output value giving the Islamic year. /// |
date | int | An integer value specifying the fixed day /// number. |
return | void |
/// <summary> /// A protected method checking an /// <see cref="F:AddHijriDate"/> adjusted fixed day number. /// </summary> /// <param name="param">A string giving the name of the parameter /// to check.</param> /// <param name="rdHijri">An integer giving the AddHijriDate adjusted /// fixed day number. /// </param> /// <exception cref="T:System.ArgumentOutOfRangeException"> /// Exception is thrown, if the AddHijriDate adjusted fixed day /// number is outside the supported range. /// </exception> internal void M_CheckFixedHijri(string param, int rdHijri) { if (rdHijri < M_MinFixed || rdHijri > M_MaxFixed - AddHijriDate) { StringWriter sw = new StringWriter(); int day, month, year; CCHijriCalendar.dmy_from_fixed(out day, out month, out year, M_MaxFixed - AddHijriDate); if (AddHijriDate != 0) { sw.Write("This HijriCalendar " + "(AddHijriDate {0})" + " allows dates from 1. 1. 1 to " + "{1}. {2}. {3}.", AddHijriDate, day, month, year); } else { sw.Write("HijriCalendar allows dates from " + "1.1.1 to {0}.{1}.{2}.", day, month, year); } throw new ArgumentOutOfRangeException(param, sw.ToString()); } }
internal void M_CheckFixedHijri(string param, int rdHijri) { if (rdHijri < UmAlQuraCalendar.M_MinFixed || rdHijri > UmAlQuraCalendar.M_MaxFixed - this.AddHijriDate) { StringWriter stringWriter = new StringWriter(); int num; int num2; int num3; CCHijriCalendar.dmy_from_fixed(out num, out num2, out num3, UmAlQuraCalendar.M_MaxFixed - this.AddHijriDate); if (this.AddHijriDate != 0) { stringWriter.Write("This HijriCalendar (AddHijriDate {0}) allows dates from 1. 1. 1 to {1}. {2}. {3}.", new object[] { this.AddHijriDate, num, num2, num3 }); } else { stringWriter.Write("HijriCalendar allows dates from 1.1.1 to {0}.{1}.{2}.", num, num2, num3); } throw new ArgumentOutOfRangeException(param, stringWriter.ToString()); } }
public static int day_from_fixed(int date) { int result; int num; int num2; CCHijriCalendar.dmy_from_fixed(out result, out num, out num2, date); return(result); }
/// <summary>Calculates a date that is a specified number of years away from a specified initial date.</summary> /// <returns>A <see cref="T:System.DateTime" /> that represents the date yielded by adding the number of years specified by the <paramref name="years" /> parameter to the date specified by the <paramref name="time" /> parameter.</returns> /// <param name="time">The <see cref="T:System.DateTime" /> to which to add years. 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> /// <param name="years">The positive or negative number of years to add. </param> /// <exception cref="T:System.ArgumentException">The resulting date is outside the range supported by the <see cref="T:System.Globalization.UmAlQuraCalendar" /> class. </exception> /// <exception cref="T:System.ArgumentOutOfRangeException"> /// <paramref name="years" /> is less than -10,000 or greater than 10,000. -or-<paramref name="time" /> is outside the range supported by this calendar.</exception> public override DateTime AddYears(DateTime time, int years) { int num = this.M_FromDateTime(time); int day; int month; int num2; CCHijriCalendar.dmy_from_fixed(out day, out month, out num2, num); num2 += years; num = CCHijriCalendar.fixed_from_dmy(day, month, num2); this.M_CheckFixedHijri("time", num); return(this.M_ToDateTime(num).Add(time.TimeOfDay)); }
/// <summary> /// Overrideden. 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 /// supported range of the Hijri calendar. /// </exception> public override DateTime AddYears(DateTime time, int years) { int rd = M_FromDateTime(time); int day, month, year; CCHijriCalendar.dmy_from_fixed( out day, out month, out year, rd); year += years; rd = CCHijriCalendar.fixed_from_dmy(day, month, year); M_CheckFixedHijri("time", rd); DateTime t = M_ToDateTime(rd); return(t.Add(time.TimeOfDay)); }
/// <summary>Calculates a date that is a specified number of months away from a specified initial date.</summary> /// <returns>A <see cref="T:System.DateTime" /> that represents the date yielded by adding the number of months specified by the <paramref name="months" /> parameter to the date specified by the <paramref name="time" /> parameter.</returns> /// <param name="time">The <see cref="T:System.DateTime" /> to which to add months. 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> /// <param name="months">The positive or negative number of months to add. </param> /// <exception cref="T:System.ArgumentException">The resulting date is outside the range supported by the <see cref="T:System.Globalization.UmAlQuraCalendar" /> class. </exception> /// <exception cref="T:System.ArgumentOutOfRangeException"> /// <paramref name="months" /> is less than -120,000 or greater than 120,000. -or-<paramref name="time" /> is outside the range supported by this calendar.</exception> public override DateTime AddMonths(DateTime time, int months) { int num = this.M_FromDateTime(time); int day; int num2; int num3; CCHijriCalendar.dmy_from_fixed(out day, out num2, out num3, num); num2 += months; num3 += CCMath.div_mod(out num2, num2, 12); num = CCHijriCalendar.fixed_from_dmy(day, num2, num3); this.M_CheckFixedHijri("time", num); return(this.M_ToDateTime(num).Add(time.TimeOfDay)); }