System.Globalization.Calendar.TimeToTicks C# (CSharp) Method

TimeToTicks() static private method

static private TimeToTicks ( int hour, int minute, int second, int millisecond ) : long
hour int
minute int
second int
millisecond int
return long
        internal static long TimeToTicks(int hour, int minute, int second, int millisecond)
        {
            if (hour >= 0 && hour < 24 && minute >= 0 && minute < 60 && second >=0 && second < 60)
            {
                if (millisecond < 0 || millisecond >= MillisPerSecond) {
                    throw new ArgumentOutOfRangeException(
                                "millisecond",
                                String.Format(
                                    CultureInfo.InvariantCulture,
                                    Environment.GetResourceString("ArgumentOutOfRange_Range"), 0, MillisPerSecond - 1));
                }
                return TimeSpan.TimeToTicks(hour, minute, second) + millisecond * TicksPerMillisecond;
            }
            throw new ArgumentOutOfRangeException(null, Environment.GetResourceString("ArgumentOutOfRange_BadHourMinuteSecond"));
        }

Usage Example

Esempio n. 1
0
        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)));
        }
All Usage Examples Of System.Globalization.Calendar::TimeToTicks