static private TimeToTicks ( int hour, int minute, int second, int millisecond ) : long | ||
hour | int | |
minute | int | |
second | int | |
millisecond | int | |
return | long |
private DateTime HebrewToGregorian(int hebrewYear, int hebrewMonth, int hebrewDay, int hour, int minute, int second, int millisecond) { int gregorianYear = hebrewYear - 0xeb0; __DateBuffer lunarDate = new __DateBuffer(); int lunarMonthDay = this.GetLunarMonthDay(gregorianYear, lunarDate); if ((hebrewMonth == lunarDate.month) && (hebrewDay == lunarDate.day)) { return(new DateTime(gregorianYear, 1, 1, hour, minute, second, millisecond)); } int num3 = this.GetDayDifference(lunarMonthDay, hebrewMonth, hebrewDay, lunarDate.month, lunarDate.day); DateTime time = new DateTime(gregorianYear, 1, 1); return(new DateTime((time.Ticks + (num3 * 0xc92a69c000L)) + Calendar.TimeToTicks(hour, minute, second, millisecond))); }
/// <summary>Returns a <see cref="T:System.DateTime" /> object that is set to the specified date, time, and era.</summary> /// <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> /// <returns>A <see cref="T:System.DateTime" /> object that is set to the specified date and time in the current era.</returns> /// <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> // Token: 0x06002F8D RID: 12173 RVA: 0x000B5EF0 File Offset: 0x000B40F0 public override DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era) { int daysInMonth = this.GetDaysInMonth(year, month, era); if (day < 1 || day > daysInMonth) { throw new ArgumentOutOfRangeException("day", string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("ArgumentOutOfRange_Day"), daysInMonth, month)); } long absoluteDatePersian = this.GetAbsoluteDatePersian(year, month, day); if (absoluteDatePersian >= 0L) { return(new DateTime(absoluteDatePersian * 864000000000L + Calendar.TimeToTicks(hour, minute, second, millisecond))); } throw new ArgumentOutOfRangeException(null, Environment.GetResourceString("ArgumentOutOfRange_BadYearMonthDay")); }
public override DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era) { int num = this.GetDaysInMonth(year, month, era); if ((day < 1) || (day > num)) { throw new ArgumentOutOfRangeException("day", string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("ArgumentOutOfRange_Day"), new object[] { num, month })); } long num2 = this.GetAbsoluteDateHijri(year, month, day); if (num2 < 0L) { throw new ArgumentOutOfRangeException(null, Environment.GetResourceString("ArgumentOutOfRange_BadYearMonthDay")); } return(new DateTime((num2 * 0xc92a69c000L) + Calendar.TimeToTicks(hour, minute, second, millisecond))); }
private static DateTime HebrewToGregorian(int hebrewYear, int hebrewMonth, int hebrewDay, int hour, int minute, int second, int millisecond) { int num = hebrewYear - 3760; HebrewCalendar.__DateBuffer lunarDate = new HebrewCalendar.__DateBuffer(); int lunarMonthDay = HebrewCalendar.GetLunarMonthDay(num, lunarDate); if (hebrewMonth == lunarDate.month && hebrewDay == lunarDate.day) { return(new DateTime(num, 1, 1, hour, minute, second, millisecond)); } int dayDifference = HebrewCalendar.GetDayDifference(lunarMonthDay, hebrewMonth, hebrewDay, lunarDate.month, lunarDate.day); return(new DateTime(new DateTime(num, 1, 1).Ticks + (long)dayDifference * 864000000000L + Calendar.TimeToTicks(hour, minute, second, millisecond))); }