public static ToDateTime ( int date ) : System.DateTime | ||
date | int | A integer representing the fixed day number. /// |
return | System.DateTime |
/// <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)); }
/// <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)); }
/// <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)); }
/// <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 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> /// 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>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); }
/// <summary>Returns a <see cref="T:System.DateTime" /> that is offset the specified number of months from the specified <see cref="T:System.DateTime" />.</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. </param> /// <param name="months">The positive or negative 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) { int date = CCFixed.FromDateTime(time); int day; int num; int num2; this.dmy_from_fixed(out day, out num, out num2, date); num += months; num2 += CCMath.div_mod(out num, num, 12); date = this.fixed_from_dmy(day, num, num2); DateTime dateTime = CCFixed.ToDateTime(date).Add(time.TimeOfDay); this.M_CheckDateTime(dateTime); return(dateTime); }
public static DateTime AddYears(DateTime time, int years) { int date = CCFixed.FromDateTime(time); int num; int month; int num2; CCGregorianCalendar.dmy_from_fixed(out num, out month, out num2, date); num2 += years; int daysInMonth = CCGregorianCalendar.GetDaysInMonth(num2, month); if (num > daysInMonth) { num = daysInMonth; } date = CCGregorianCalendar.fixed_from_dmy(num, month, num2); return(CCFixed.ToDateTime(date).Add(time.TimeOfDay)); }
public static DateTime AddMonths(DateTime time, int months) { int date = CCFixed.FromDateTime(time); int num; int num2; int num3; CCGregorianCalendar.dmy_from_fixed(out num, out num2, out num3, date); num2 += months; num3 += CCMath.div_mod(out num2, num2, 12); int daysInMonth = CCGregorianCalendar.GetDaysInMonth(num3, num2); if (num > daysInMonth) { num = daysInMonth; } date = CCGregorianCalendar.fixed_from_dmy(num, num2, num3); return(CCFixed.ToDateTime(date).Add(time.TimeOfDay)); }
/// <summary> /// Protected member which converts the /// <see cref="F:AddHijriDate"/> /// adjusted fixed day number the a /// <see cref="T:System.DateTime"/> value using a number /// of time parameters. /// </summary> /// <param name="date">The /// <see cref="F:AddHijriDate"/> adjusted fixed day number. /// </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> /// <returns>The converted /// <see cref="T:System.DateTime"/> value. /// </returns> internal DateTime M_ToDateTime(int date, int hour, int minute, int second, int milliseconds) { return(CCFixed.ToDateTime(date + AddHijriDate, hour, minute, second, milliseconds)); }
/// <summary> /// Protected member which converts the /// <see cref="F:AddHijriDate"/> /// adjusted fixed day number the a /// <see cref="T:System.DateTime"/> value. /// </summary> /// <param name="rd">The /// <see cref="F:AddHijriDate"/> adjusted fixed day number. /// </param> /// <returns>The converted /// <see cref="T:System.DateTime"/> value. /// </returns> internal DateTime M_ToDateTime(int rd) { return(CCFixed.ToDateTime(rd + AddHijriDate)); }
public static DateTime ToDateTime(int date, int hour, int minute, int second, double milliseconds) { return(CCFixed.ToDateTime(date).AddHours((double)hour).AddMinutes((double)minute).AddSeconds((double)second).AddMilliseconds(milliseconds)); }
public static DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int milliseconds) { return(CCFixed.ToDateTime(CCGregorianCalendar.fixed_from_dmy(day, month, year), hour, minute, second, (double)milliseconds)); }