12 [__DynamicallyInvokable]
15 private const long TicksPerMillisecond = 10000
L;
17 private const long TicksPerSecond = 10000000
L;
19 private const long TicksPerMinute = 600000000
L;
21 private const long TicksPerHour = 36000000000
L;
23 private const long TicksPerDay = 864000000000
L;
25 private const int MillisPerSecond = 1000;
27 private const int MillisPerMinute = 60000;
29 private const int MillisPerHour = 3600000;
31 private const int MillisPerDay = 86400000;
33 private const int DaysPerYear = 365;
35 private const int DaysPer4Years = 1461;
37 private const int DaysPer100Years = 36524;
39 private const int DaysPer400Years = 146097;
41 private const int DaysTo1601 = 584388;
43 private const int DaysTo1899 = 693593;
45 internal const int DaysTo1970 = 719162;
47 private const int DaysTo10000 = 3652059;
49 internal const long MinTicks = 0
L;
51 internal const long MaxTicks = 3155378975999999999
L;
53 private const long MaxMillis = 315537897600000
L;
55 private const long FileTimeOffset = 504911232000000000
L;
57 private const long DoubleDateOffset = 599264352000000000
L;
59 private const long OADateMinAsTicks = 31241376000000000
L;
61 private const double OADateMinAsDouble = -657435.0;
63 private const double OADateMaxAsDouble = 2958466.0;
65 private const int DatePartYear = 0;
67 private const int DatePartDayOfYear = 1;
69 private const int DatePartMonth = 2;
71 private const int DatePartDay = 3;
73 private static readonly
int[] DaysToMonth365 =
new int[13]
90 private static readonly
int[] DaysToMonth366 =
new int[13]
108 [__DynamicallyInvokable]
112 [__DynamicallyInvokable]
115 private const ulong TicksMask = 4611686018427387903uL;
117 private const ulong FlagsMask = 13835058055282163712uL;
119 private const ulong LocalMask = 9223372036854775808uL;
121 private const long TicksCeiling = 4611686018427387904
L;
123 private const ulong KindUnspecified = 0uL;
125 private const ulong KindUtc = 4611686018427387904uL;
127 private const ulong KindLocal = 9223372036854775808uL;
129 private const ulong KindLocalAmbiguousDst = 13835058055282163712uL;
131 private const int KindShift = 62;
133 private const string TicksField =
"ticks";
135 private const string DateDataField =
"dateData";
137 private ulong dateData;
139 internal long InternalTicks => (long)(dateData & 0x3FFFFFFFFFFFFFFF);
141 private ulong InternalKind => (ulong)((
long)dateData & -4611686018427387904
L);
145 [__DynamicallyInvokable]
148 [__DynamicallyInvokable]
151 long internalTicks = InternalTicks;
152 return new DateTime((ulong)((internalTicks - internalTicks % 864000000000
L) | (
long)InternalKind));
158 [__DynamicallyInvokable]
161 [__DynamicallyInvokable]
164 return GetDatePart(3);
170 [__DynamicallyInvokable]
173 [__DynamicallyInvokable]
176 return (
DayOfWeek)((InternalTicks / 864000000000
L + 1) % 7);
182 [__DynamicallyInvokable]
185 [__DynamicallyInvokable]
188 return GetDatePart(1);
194 [__DynamicallyInvokable]
197 [__DynamicallyInvokable]
200 return (
int)(InternalTicks / 36000000000
L % 24);
206 [__DynamicallyInvokable]
209 [__DynamicallyInvokable]
212 switch (InternalKind)
216 case 4611686018427387904uL:
226 [__DynamicallyInvokable]
229 [__DynamicallyInvokable]
232 return (
int)(InternalTicks / 10000 % 1000);
238 [__DynamicallyInvokable]
241 [__DynamicallyInvokable]
244 return (
int)(InternalTicks / 600000000 % 60);
250 [__DynamicallyInvokable]
253 [__DynamicallyInvokable]
256 return GetDatePart(2);
262 [__DynamicallyInvokable]
265 [__DynamicallyInvokable]
269 bool isAmbiguousLocalDst =
false;
270 long ticks =
TimeZoneInfo.GetDateTimeNowUtcOffsetFromUtc(utcNow, out isAmbiguousLocalDst).
Ticks;
271 long num = utcNow.
Ticks + ticks;
272 if (num > 3155378975999999999
L)
286 [__DynamicallyInvokable]
289 [SecuritySafeCritical]
290 [__DynamicallyInvokable]
294 num = GetSystemTimeAsFileTime();
295 return new DateTime((ulong)((num + 504911232000000000
L) | 0x4000000000000000));
301 [__DynamicallyInvokable]
304 [__DynamicallyInvokable]
307 return (
int)(InternalTicks / 10000000 % 60);
313 [__DynamicallyInvokable]
316 [__DynamicallyInvokable]
319 return InternalTicks;
325 [__DynamicallyInvokable]
328 [__DynamicallyInvokable]
331 return new TimeSpan(InternalTicks % 864000000000
L);
337 [__DynamicallyInvokable]
340 [__DynamicallyInvokable]
349 [__DynamicallyInvokable]
352 [__DynamicallyInvokable]
355 return GetDatePart(0);
363 [__DynamicallyInvokable]
366 if (ticks < 0 || ticks > 3155378975999999999
L)
370 dateData = (ulong)ticks;
375 this.dateData = dateData;
385 [__DynamicallyInvokable]
388 if (ticks < 0 || ticks > 3155378975999999999
L)
392 if (kind < DateTimeKind.Unspecified || kind >
DateTimeKind.Local)
396 dateData = (ulong)(ticks | ((
long)kind << 62));
401 if (ticks < 0 || ticks > 3155378975999999999
L)
405 dateData = (ulong)(ticks | (isAmbiguousDst ? (-4611686018427387904
L) :
long.MinValue));
416 [__DynamicallyInvokable]
419 dateData = (ulong)DateToTicks(year, month, day);
435 this =
new DateTime(year, month, day, 0, 0, 0, calendar);
452 [__DynamicallyInvokable]
453 public DateTime(
int year,
int month,
int day,
int hour,
int minute,
int second)
455 dateData = (ulong)(DateToTicks(year, month, day) + TimeToTicks(hour, minute, second));
475 [__DynamicallyInvokable]
478 if (kind < DateTimeKind.Unspecified || kind >
DateTimeKind.Local)
482 long num = DateToTicks(year, month, day) + TimeToTicks(hour, minute, second);
483 dateData = (ulong)(num | ((
long)kind << 62));
503 public DateTime(
int year,
int month,
int day,
int hour,
int minute,
int second,
Calendar calendar)
505 if (calendar ==
null)
509 dateData = (ulong)calendar.
ToDateTime(year, month, day, hour, minute, second, 0).
Ticks;
528 [__DynamicallyInvokable]
529 public DateTime(
int year,
int month,
int day,
int hour,
int minute,
int second,
int millisecond)
531 if (millisecond < 0 || millisecond >= 1000)
535 long num = DateToTicks(year, month, day) + TimeToTicks(hour, minute, second);
536 num += (long)millisecond * 10000
L;
537 if (num < 0 || num > 3155378975999999999
L)
541 dateData = (ulong)num;
563 [__DynamicallyInvokable]
564 public DateTime(
int year,
int month,
int day,
int hour,
int minute,
int second,
int millisecond,
DateTimeKind kind)
566 if (millisecond < 0 || millisecond >= 1000)
570 if (kind < DateTimeKind.Unspecified || kind >
DateTimeKind.Local)
574 long num = DateToTicks(year, month, day) + TimeToTicks(hour, minute, second);
575 num += (long)millisecond * 10000
L;
576 if (num < 0 || num > 3155378975999999999
L)
580 dateData = (ulong)(num | ((
long)kind << 62));
602 public DateTime(
int year,
int month,
int day,
int hour,
int minute,
int second,
int millisecond,
Calendar calendar)
604 if (calendar ==
null)
608 if (millisecond < 0 || millisecond >= 1000)
612 long ticks = calendar.
ToDateTime(year, month, day, hour, minute, second, 0).
Ticks;
613 ticks += (long)millisecond * 10000
L;
614 if (ticks < 0 || ticks > 3155378975999999999
L)
618 dateData = (ulong)ticks;
645 if (calendar ==
null)
649 if (millisecond < 0 || millisecond >= 1000)
653 if (kind < DateTimeKind.Unspecified || kind >
DateTimeKind.Local)
657 long ticks = calendar.
ToDateTime(year, month, day, hour, minute, second, 0).
Ticks;
658 ticks += (long)millisecond * 10000
L;
659 if (ticks < 0 || ticks > 3155378975999999999
L)
663 dateData = (ulong)(ticks | ((
long)kind << 62));
679 string name = enumerator.
Name;
680 if (!(name ==
"ticks"))
682 if (name ==
"dateData")
704 dateData = (ulong)num;
706 long internalTicks = InternalTicks;
707 if (internalTicks < 0 || internalTicks > 3155378975999999999
L)
717 [__DynamicallyInvokable]
725 long num = (long)(value * (
double)scale + ((value >= 0.0) ? 0.5 : (-0.5)));
726 if (num <= -315537897600000L || num >= 315537897600000
L)
737 [__DynamicallyInvokable]
740 return Add(value, 86400000);
747 [__DynamicallyInvokable]
750 return Add(value, 3600000);
757 [__DynamicallyInvokable]
760 return Add(value, 1);
767 [__DynamicallyInvokable]
770 return Add(value, 60000);
778 [__DynamicallyInvokable]
781 if (months < -120000 || months > 120000)
785 int datePart = GetDatePart(0);
786 int datePart2 = GetDatePart(2);
787 int num = GetDatePart(3);
788 int num2 = datePart2 - 1 + months;
791 datePart2 = num2 % 12 + 1;
792 datePart += num2 / 12;
796 datePart2 = 12 + (num2 + 1) % 12;
797 datePart += (num2 - 11) / 12;
799 if (datePart < 1 || datePart > 9999)
808 return new DateTime((ulong)((DateToTicks(datePart, datePart2, num) + InternalTicks % 864000000000
L) | (
long)InternalKind));
815 [__DynamicallyInvokable]
818 return Add(value, 1000);
825 [__DynamicallyInvokable]
828 long internalTicks = InternalTicks;
829 if (value > 3155378975999999999
L - internalTicks || value < -internalTicks)
833 return new DateTime((ulong)((internalTicks + value) | (
long)InternalKind));
841 [__DynamicallyInvokable]
844 if (value < -10000 || value > 10000)
858 [__DynamicallyInvokable]
861 long internalTicks = t1.InternalTicks;
862 long internalTicks2 = t2.InternalTicks;
863 if (internalTicks > internalTicks2)
867 if (internalTicks < internalTicks2)
889 long internalTicks = ((
DateTime)value).InternalTicks;
890 long internalTicks2 = InternalTicks;
891 if (internalTicks2 > internalTicks)
895 if (internalTicks2 < internalTicks)
905 [__DynamicallyInvokable]
908 long internalTicks = value.InternalTicks;
909 long internalTicks2 = InternalTicks;
910 if (internalTicks2 > internalTicks)
914 if (internalTicks2 < internalTicks)
921 private static long DateToTicks(
int year,
int month,
int day)
923 if (year >= 1 && year <= 9999 && month >= 1 && month <= 12)
925 int[] array =
IsLeapYear(year) ? DaysToMonth366 : DaysToMonth365;
926 if (day >= 1 && day <= array[month] - array[month - 1])
929 int num2 = num * 365 + num / 4 - num / 100 + num / 400 + array[month - 1] + day - 1;
930 return num2 * 864000000000
L;
933 throw new ArgumentOutOfRangeException(
null, Environment.GetResourceString(
"ArgumentOutOfRange_BadYearMonthDay"));
936 private static long TimeToTicks(
int hour,
int minute,
int second)
938 if (hour >= 0 && hour < 24 && minute >= 0 && minute < 60 && second >= 0 && second < 60)
940 return TimeSpan.TimeToTicks(hour, minute, second);
942 throw new ArgumentOutOfRangeException(
null, Environment.GetResourceString(
"ArgumentOutOfRange_BadHourMinuteSecond"));
952 [__DynamicallyInvokable]
955 if (month < 1 || month > 12)
959 int[] array =
IsLeapYear(year) ? DaysToMonth366 : DaysToMonth365;
960 return array[month] - array[month - 1];
963 internal static long DoubleDateToTicks(
double value)
965 if (!(value < 2958466.0) || !(value > -657435.0))
969 long num = (long)(value * 86400000.0 + ((value >= 0.0) ? 0.5 : (-0.5)));
972 num -= num % 86400000 * 2;
974 num += 59926435200000
L;
975 if (num < 0 || num >= 315537897600000
L)
977 throw new ArgumentException(Environment.GetResourceString(
"Arg_OleAutDateScale"));
984 [SuppressUnmanagedCodeSecurity]
986 internal static extern bool LegacyParseMode();
990 [SuppressUnmanagedCodeSecurity]
992 internal static extern bool EnableAmPmParseAdjustment();
998 [__DynamicallyInvokable]
999 public override bool Equals(
object value)
1003 return InternalTicks == ((
DateTime)value).InternalTicks;
1013 [__DynamicallyInvokable]
1016 return InternalTicks == value.InternalTicks;
1025 [__DynamicallyInvokable]
1028 return t1.InternalTicks == t2.InternalTicks;
1036 [__DynamicallyInvokable]
1041 long num = dateData & 0x3FFFFFFFFFFFFFFF;
1042 if (num > 4611685154427387904
L)
1044 num -= 4611686018427387904
L;
1046 bool isAmbiguousLocalDst =
false;
1052 else if (num > 3155378975999999999
L)
1059 bool isDaylightSavings =
false;
1065 num += 864000000000
L;
1067 if (num < 0 || num > 3155378975999999999
L)
1073 return FromBinaryRaw(dateData);
1076 internal static DateTime FromBinaryRaw(
long dateData)
1078 long num = dateData & 0x3FFFFFFFFFFFFFFF;
1079 if (num < 0 || num > 3155378975999999999
L)
1083 return new DateTime((ulong)dateData);
1091 [__DynamicallyInvokable]
1102 [__DynamicallyInvokable]
1105 if (fileTime < 0 || fileTime > 2650467743999999999
L)
1109 long ticks = fileTime + 504911232000000000
L;
1117 [__DynamicallyInvokable]
1135 info.AddValue(
"ticks", InternalTicks);
1136 info.AddValue(
"dateData", dateData);
1142 [__DynamicallyInvokable]
1156 [__DynamicallyInvokable]
1159 return new DateTime(value.InternalTicks, kind);
1164 [__DynamicallyInvokable]
1169 TimeSpan localUtcOffset =
TimeZoneInfo.GetLocalUtcOffset(
this, TimeZoneInfoOptions.NoThrowOnInvalidTime);
1171 long num = ticks - localUtcOffset.
Ticks;
1174 num = 4611686018427387904
L + num;
1176 return num |
long.MinValue;
1178 return (
long)dateData;
1181 internal long ToBinaryRaw()
1183 return (
long)dateData;
1186 private int GetDatePart(
int part)
1188 long internalTicks = InternalTicks;
1189 int num = (int)(internalTicks / 864000000000
L);
1190 int num2 = num / 146097;
1191 num -= num2 * 146097;
1192 int num3 = num / 36524;
1197 num -= num3 * 36524;
1198 int num4 = num / 1461;
1200 int num5 = num / 365;
1207 return num2 * 400 + num3 * 100 + num4 * 4 + num5 + 1;
1214 int[] array = (num5 == 3 && (num4 != 24 || num3 == 3)) ? DaysToMonth366 : DaysToMonth365;
1216 for (i = num >> 6; num >= array[i]; i++)
1223 return num - array[i - 1] + 1;
1228 [__DynamicallyInvokable]
1231 long internalTicks = InternalTicks;
1232 return (
int)internalTicks ^ (int)(internalTicks >> 32);
1235 internal bool IsAmbiguousDaylightSavingTime()
1237 return InternalKind == 13835058055282163712uL;
1242 internal static extern long GetSystemTimeAsFileTime();
1250 [__DynamicallyInvokable]
1253 if (year < 1 || year > 9999)
1259 if (year % 100 == 0)
1261 return year % 400 == 0;
1275 [__DynamicallyInvokable]
1289 [__DynamicallyInvokable]
1306 [__DynamicallyInvokable]
1324 [__DynamicallyInvokable]
1344 [__DynamicallyInvokable]
1348 return DateTimeParse.ParseExact(s, format,
DateTimeFormatInfo.GetInstance(provider), style);
1365 [__DynamicallyInvokable]
1369 return DateTimeParse.ParseExactMultiple(s, formats,
DateTimeFormatInfo.GetInstance(provider), style);
1376 [__DynamicallyInvokable]
1379 return new TimeSpan(InternalTicks - value.InternalTicks);
1386 [__DynamicallyInvokable]
1389 long internalTicks = InternalTicks;
1390 long ticks = value._ticks;
1391 if (internalTicks - 0 < ticks || internalTicks - 3155378975999999999
L > ticks)
1395 return new DateTime((ulong)((internalTicks - ticks) | (
long)InternalKind));
1398 private static double TicksToOADate(
long value)
1404 if (value < 864000000000
L)
1406 value += 599264352000000000
L;
1408 if (value < 31241376000000000
L)
1410 throw new OverflowException(Environment.GetResourceString(
"Arg_OleAutDateInvalid"));
1412 long num = (value - 599264352000000000
L) / 10000;
1415 long num2 = num % 86400000;
1418 num -= (86400000 + num2) * 2;
1421 return (
double)num / 86400000.0;
1427 [__DynamicallyInvokable]
1430 return TicksToOADate(InternalTicks);
1436 [__DynamicallyInvokable]
1445 [__DynamicallyInvokable]
1449 num -= 504911232000000000
L;
1459 [__DynamicallyInvokable]
1471 bool isDaylightSavings =
false;
1472 bool isAmbiguousLocalDst =
false;
1473 long ticks = TimeZoneInfo.GetUtcOffsetFromUtc(
this, TimeZoneInfo.Local, out isDaylightSavings, out isAmbiguousLocalDst).
Ticks;
1474 long num =
Ticks + ticks;
1475 if (num > 3155378975999999999
L)
1477 if (throwOnOverflow)
1479 throw new ArgumentException(Environment.GetResourceString(
"Arg_ArgumentOutOfRangeException"));
1485 if (throwOnOverflow)
1487 throw new ArgumentException(Environment.GetResourceString(
"Arg_ArgumentOutOfRangeException"));
1525 [__DynamicallyInvokable]
1537 [__DynamicallyInvokable]
1547 [__DynamicallyInvokable]
1560 [__DynamicallyInvokable]
1563 return DateTimeFormat.Format(
this, format,
DateTimeFormatInfo.GetInstance(provider));
1568 [__DynamicallyInvokable]
1579 [__DynamicallyInvokable]
1597 [__DynamicallyInvokable]
1601 return DateTimeParse.TryParse(s,
DateTimeFormatInfo.GetInstance(provider), styles, out result);
1615 [__DynamicallyInvokable]
1619 return DateTimeParse.TryParseExact(s, format,
DateTimeFormatInfo.GetInstance(provider), style, out result);
1633 [__DynamicallyInvokable]
1637 return DateTimeParse.TryParseExactMultiple(s, formats,
DateTimeFormatInfo.GetInstance(provider), style, out result);
1645 [__DynamicallyInvokable]
1648 long internalTicks = d.InternalTicks;
1649 long ticks = t._ticks;
1650 if (ticks > 3155378975999999999
L - internalTicks || ticks < -internalTicks)
1654 return new DateTime((ulong)((internalTicks + ticks) | (
long)d.InternalKind));
1662 [__DynamicallyInvokable]
1665 long internalTicks = d.InternalTicks;
1666 long ticks = t._ticks;
1667 if (internalTicks - 0 < ticks || internalTicks - 3155378975999999999
L > ticks)
1671 return new DateTime((ulong)((internalTicks - ticks) | (
long)d.InternalKind));
1678 [__DynamicallyInvokable]
1681 return new TimeSpan(d1.InternalTicks - d2.InternalTicks);
1689 [__DynamicallyInvokable]
1692 return d1.InternalTicks == d2.InternalTicks;
1700 [__DynamicallyInvokable]
1703 return d1.InternalTicks != d2.InternalTicks;
1711 [__DynamicallyInvokable]
1714 return t1.InternalTicks < t2.InternalTicks;
1722 [__DynamicallyInvokable]
1725 return t1.InternalTicks <= t2.InternalTicks;
1733 [__DynamicallyInvokable]
1736 return t1.InternalTicks > t2.InternalTicks;
1744 [__DynamicallyInvokable]
1747 return t1.InternalTicks >= t2.InternalTicks;
1752 [__DynamicallyInvokable]
1761 [__DynamicallyInvokable]
1764 return DateTimeFormat.GetAllDateTimes(
this,
DateTimeFormatInfo.GetInstance(provider));
1772 [__DynamicallyInvokable]
1784 [__DynamicallyInvokable]
1787 return DateTimeFormat.GetAllDateTimes(
this, format,
DateTimeFormatInfo.GetInstance(provider));
1801 [__DynamicallyInvokable]
1811 [__DynamicallyInvokable]
1821 [__DynamicallyInvokable]
1831 [__DynamicallyInvokable]
1841 [__DynamicallyInvokable]
1851 [__DynamicallyInvokable]
1861 [__DynamicallyInvokable]
1871 [__DynamicallyInvokable]
1881 [__DynamicallyInvokable]
1891 [__DynamicallyInvokable]
1901 [__DynamicallyInvokable]
1911 [__DynamicallyInvokable]
1921 [__DynamicallyInvokable]
1930 [__DynamicallyInvokable]
1943 [__DynamicallyInvokable]
1946 return Convert.DefaultToType(
this, type, provider);
1949 internal static bool TryCreate(
int year,
int month,
int day,
int hour,
int minute,
int second,
int millisecond, out
DateTime result)
1952 if (year < 1 || year > 9999 || month < 1 || month > 12)
1956 int[] array =
IsLeapYear(year) ? DaysToMonth366 : DaysToMonth365;
1957 if (day < 1 || day > array[month] - array[month - 1])
1961 if (hour < 0 || hour >= 24 || minute < 0 || minute >= 60 || second < 0 || second >= 60)
1965 if (millisecond < 0 || millisecond >= 1000)
1969 long num = DateToTicks(year, month, day) + TimeToTicks(hour, minute, second);
1970 num += (long)millisecond * 10000
L;
1971 if (num < 0 || num > 3155378975999999999
L)
float ToSingle(IFormatProvider provider)
Converts the value of this instance to an equivalent single-precision floating-point number using the...
Converts a base data type to another base data type.
static bool operator >=(DateTime t1, DateTime t2)
Determines whether one specified T:System.DateTime represents a date and time that is the same as or ...
DateTime(long ticks, DateTimeKind kind)
Initializes a new instance of the T:System.DateTime structure to a specified number of ticks and to C...
Represents any time zone in the world.
static int DaysInMonth(int year, int month)
Returns the number of days in the specified month and year.
static CultureInfo InvariantCulture
Gets the T:System.Globalization.CultureInfo object that is culture-independent (invariant).
string ToString(IFormatProvider provider)
Converts the value of the current T:System.DateTime object to its equivalent string representation us...
DateTime AddYears(int value)
Returns a new T:System.DateTime that adds the specified number of years to the value of this instance...
static bool operator !=(DateTime d1, DateTime d2)
Determines whether two specified instances of T:System.DateTime are not equal.
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
Represents time in divisions, such as weeks, months, and years.
static DateTime ParseExact(string s, string format, IFormatProvider provider)
Converts the specified string representation of a date and time to its T:System.DateTime equivalent u...
DateTime(int year, int month, int day)
Initializes a new instance of the T:System.DateTime structure to the specified year,...
static DateTime FromFileTime(long fileTime)
Converts the specified Windows file time to an equivalent local time.
string ToShortDateString()
Converts the value of the current T:System.DateTime object to its equivalent short date string repres...
bool IsDaylightSavingTime()
Indicates whether this instance of T:System.DateTime is within the daylight saving time range for the...
double ToDouble(IFormatProvider provider)
Converts the value of this instance to an equivalent double-precision floating-point number using the...
static DateTime Parse(string s, IFormatProvider provider)
Converts the string representation of a date and time to its T:System.DateTime equivalent by using cu...
bool IsDaylightSavingTime(DateTimeOffset dateTimeOffset)
Indicates whether a specified date and time falls in the range of daylight saving time for the time z...
long ToFileTimeUtc()
Converts the value of the current T:System.DateTime object to a Windows file time.
static readonly DateTime MinValue
Represents the smallest possible value of T:System.DateTime. This field is read-only.
object Value
Gets the value of the item currently being examined.
bool ToBoolean(IFormatProvider provider)
Converts the value of this instance to an equivalent Boolean value using the specified culture-specif...
TypeCode
Specifies the type of an object.
LayoutKind
Controls the layout of an object when exported to unmanaged code.
static TimeSpan operator -(DateTime d1, DateTime d2)
Subtracts a specified date and time from another specified date and time and returns a time interval.
The exception that is thrown when the value of an argument is outside the allowable range of values a...
DateTime(int year, int month, int day, int hour, int minute, int second)
Initializes a new instance of the T:System.DateTime structure to the specified year,...
bool Equals(DateTime value)
Returns a value indicating whether the value of this instance is equal to the value of the specified ...
The exception that is thrown for invalid casting or explicit conversion.
DateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, Calendar calendar)
Initializes a new instance of the T:System.DateTime structure to the specified year,...
char ToChar(IFormatProvider provider)
Converts the value of this instance to an equivalent Unicode character using the specified culture-sp...
string ToString(string format, IFormatProvider provider)
Converts the value of the current T:System.DateTime object to its equivalent string representation us...
DateTime Subtract(TimeSpan value)
Subtracts the specified duration from this instance.
TimeSpan TimeOfDay
Gets the time of day for this instance.
Represents an instant in time, typically expressed as a date and time of day. To browse the ....
static bool IsLeapYear(int year)
Returns an indication whether the specified year is a leap year.
DateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, Calendar calendar, DateTimeKind kind)
Initializes a new instance of the T:System.DateTime structure to the specified year,...
string [] GetDateTimeFormats(IFormatProvider provider)
Converts the value of this instance to all the string representations supported by the standard date ...
TypeCode GetTypeCode()
Returns the T:System.TypeCode for value type T:System.DateTime.
DateTime ToDateTime(IFormatProvider provider)
Converts the value of this instance to an equivalent T:System.DateTime using the specified culture-sp...
Describes the source and destination of a given serialized stream, and provides an additional caller-...
sbyte ToSByte(IFormatProvider provider)
Converts the value of this instance to an equivalent 8-bit signed integer using the specified culture...
Defines a generalized type-specific comparison method that a value type or class implements to order ...
int CompareTo(object value)
Compares the value of this instance to a specified object that contains a specified T:System....
static DateTime FromFileTimeUtc(long fileTime)
Converts the specified Windows file time to an equivalent UTC time.
int Second
Gets the seconds component of the date represented by this instance.
DateTime ToLocalTime()
Converts the value of the current T:System.DateTime object to local time.
DateTime(int year, int month, int day, Calendar calendar)
Initializes a new instance of the T:System.DateTime structure to the specified year,...
string ToShortTimeString()
Converts the value of the current T:System.DateTime object to its equivalent short time string repres...
int Hour
Gets the hour component of the date represented by this instance.
long Ticks
Gets the number of ticks that represent the value of the current T:System.TimeSpan structure.
int Year
Gets the year component of the date represented by this instance.
Provides information about, and means to manipulate, the current environment and platform....
override int GetHashCode()
Returns the hash code for this instance.
string ToLongTimeString()
Converts the value of the current T:System.DateTime object to its equivalent long time string represe...
string ToLongDateString()
Converts the value of the current T:System.DateTime object to its equivalent long date string represe...
static DateTime Parse(string s)
Converts the string representation of a date and time to its T:System.DateTime equivalent.
decimal ToDecimal(IFormatProvider provider)
Converts the value of this instance to an equivalent T:System.Decimal number using the specified cult...
string ToString(string format)
Converts the value of the current T:System.DateTime object to its equivalent string representation us...
static DateTime FromBinary(long dateData)
Deserializes a 64-bit binary value and recreates an original serialized T:System.DateTime object.
DateTimeKind Kind
Gets a value that indicates whether the time represented by this instance is based on local time,...
override string ToString()
Converts the value of the current T:System.DateTime object to its equivalent string representation us...
A cast or conversion operation, such as (SampleType)obj in C::or CType(obj, SampleType) in Visual Bas...
int ToInt32(IFormatProvider provider)
Converts the value of this instance to an equivalent 32-bit signed integer using the specified cultur...
UnmanagedType
Identifies how to marshal parameters or fields to unmanaged code.
static bool TryParse(string s, out DateTime result)
Converts the specified string representation of a date and time to its T:System.DateTime equivalent a...
static bool operator<(DateTime t1, DateTime t2)
Determines whether one specified T:System.DateTime is earlier than another specified T:System....
DateTime AddDays(double value)
Returns a new T:System.DateTime that adds the specified number of days to the value of this instance.
static DateTime ParseExact(string s, string format, IFormatProvider provider, DateTimeStyles style)
Converts the specified string representation of a date and time to its T:System.DateTime equivalent u...
DateTime AddMonths(int months)
Returns a new T:System.DateTime that adds the specified number of months to the value of this instanc...
static readonly DateTime MaxValue
Represents the largest possible value of T:System.DateTime. This field is read-only.
static DateTime ParseExact(string s, string[] formats, IFormatProvider provider, DateTimeStyles style)
Converts the specified string representation of a date and time to its T:System.DateTime equivalent u...
int Minute
Gets the minute component of the date represented by this instance.
DateTime Date
Gets the date component of this instance.
DateTime Add(TimeSpan value)
Returns a new T:System.DateTime that adds the value of the specified T:System.TimeSpan to the value o...
TimeSpan Subtract(DateTime value)
Subtracts the specified date and time from this instance.
long ToFileTime()
Converts the value of the current T:System.DateTime object to a Windows file time.
override bool Equals(object value)
Returns a value indicating whether this instance is equal to a specified object.
object ToType(Type conversionType, IFormatProvider provider)
Converts the value of this instance to an T:System.Object of the specified T:System....
Represents type declarations: class types, interface types, array types, value types,...
The exception thrown when an error occurs during serialization or deserialization.
static DateTime SpecifyKind(DateTime value, DateTimeKind kind)
Creates a new T:System.DateTime object that has the same number of ticks as the specified T:System....
static DateTime UtcNow
Gets a T:System.DateTime object that is set to the current date and time on this computer,...
ushort ToUInt16(IFormatProvider provider)
Converts the value of this instance to an equivalent 16-bit unsigned integer using the specified cult...
MethodImplOptions
Defines the details of how a method is implemented.
string [] GetDateTimeFormats(char format)
Converts the value of this instance to all the string representations supported by the specified stan...
CharSet
Dictates which character set marshaled strings should use.
int Day
Gets the day of the month represented by this instance.
long ToBinary()
Serializes the current T:System.DateTime object to a 64-bit binary value that subsequently can be use...
DateTime(long ticks)
Initializes a new instance of the T:System.DateTime structure to a specified number of ticks.
DateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, DateTimeKind kind)
Initializes a new instance of the T:System.DateTime structure to the specified year,...
static bool TryParseExact(string s, string[] formats, IFormatProvider provider, DateTimeStyles style, out DateTime result)
Converts the specified string representation of a date and time to its T:System.DateTime equivalent u...
int CompareTo(DateTime value)
Compares the value of this instance to a specified T:System.DateTime value and returns an integer tha...
double ToOADate()
Converts the value of this instance to the equivalent OLE Automation date.
Stores all the data needed to serialize or deserialize an object. This class cannot be inherited.
short ToInt16(IFormatProvider provider)
Converts the value of this instance to an equivalent 16-bit signed integer using the specified cultur...
static bool TryParseExact(string s, string format, IFormatProvider provider, DateTimeStyles style, out DateTime result)
Converts the specified string representation of a date and time to its T:System.DateTime equivalent u...
static DateTime Today
Gets the current date.
static CultureInfo CurrentCulture
Gets or sets the T:System.Globalization.CultureInfo object that represents the culture used by the cu...
long ToInt64(IFormatProvider provider)
Converts the value of this instance to an equivalent 64-bit signed integer using the specified cultur...
The exception that is thrown when one of the arguments provided to a method is not valid.
static bool operator==(DateTime d1, DateTime d2)
Determines whether two specified instances of T:System.DateTime are equal.
Allows an object to control its own serialization and deserialization.
DateTime AddMilliseconds(double value)
Returns a new T:System.DateTime that adds the specified number of milliseconds to the value of this i...
string [] GetDateTimeFormats(char format, IFormatProvider provider)
Converts the value of this instance to all the string representations supported by the specified stan...
int Month
Gets the month component of the date represented by this instance.
Defines a generalized method that a value type or class implements to create a type-specific method f...
DateTimeKind
Specifies whether a T:System.DateTime object represents a local time, a Coordinated Universal Time (U...
DateTime AddHours(double value)
Returns a new T:System.DateTime that adds the specified number of hours to the value of this instance...
static DateTime FromOADate(double d)
Returns a T:System.DateTime equivalent to the specified OLE Automation Date.
DateTime(int year, int month, int day, int hour, int minute, int second, DateTimeKind kind)
Initializes a new instance of the T:System.DateTime structure to the specified year,...
Represents a time interval.To browse the .NET Framework source code for this type,...
int DayOfYear
Gets the day of the year represented by this instance.
Specifies that the class can be serialized.
static DateTime Parse(string s, IFormatProvider provider, DateTimeStyles styles)
Converts the string representation of a date and time to its T:System.DateTime equivalent by using cu...
string Name
Gets the name for the item currently being examined.
static DateTime Now
Gets a T:System.DateTime object that is set to the current date and time on this computer,...
DateTime(int year, int month, int day, int hour, int minute, int second, Calendar calendar)
Initializes a new instance of the T:System.DateTime structure to the specified year,...
static DateTime ConvertTimeToUtc(DateTime dateTime)
Converts the specified date and time to Coordinated Universal Time (UTC).
static int Compare(DateTime t1, DateTime t2)
Compares two instances of T:System.DateTime and returns an integer that indicates whether the first i...
static DateTime operator+(DateTime d, TimeSpan t)
Adds a specified time interval to a specified date and time, yielding a new date and time.
static bool Equals(DateTime t1, DateTime t2)
Returns a value indicating whether two T:System.DateTime instances have the same date and time value.
ulong ToUInt64(IFormatProvider provider)
Converts the value of this instance to an equivalent 64-bit unsigned integer using the specified cult...
DateTime AddMinutes(double value)
Returns a new T:System.DateTime that adds the specified number of minutes to the value of this instan...
byte ToByte(IFormatProvider provider)
Converts the value of this instance to an equivalent 8-bit unsigned integer using the specified cultu...
Provides information about a specific culture (called a locale for unmanaged code development)....
DateTime ToUniversalTime()
Converts the value of the current T:System.DateTime object to Coordinated Universal Time (UTC).
Defines methods that convert the value of the implementing reference or value type to a common langua...
static TimeZoneInfo Local
Gets a T:System.TimeZoneInfo object that represents the local time zone.
DateTime AddSeconds(double value)
Returns a new T:System.DateTime that adds the specified number of seconds to the value of this instan...
Provides a formatter-friendly mechanism for parsing the data in T:System.Runtime.Serialization....
static DateTime operator -(DateTime d, TimeSpan t)
Subtracts a specified time interval from a specified date and time and returns a new date and time.
DateTimeStyles
Defines the formatting options that customize string parsing for some date and time parsing methods.
void GetObjectData(SerializationInfo info, StreamingContext context)
Populates a T:System.Runtime.Serialization.SerializationInfo with the data needed to serialize the ta...
static bool operator >(DateTime t1, DateTime t2)
Determines whether one specified T:System.DateTime is later than another specified T:System....
DateTime AddTicks(long value)
Returns a new T:System.DateTime that adds the specified number of ticks to the value of this instance...
uint ToUInt32(IFormatProvider provider)
Converts the value of this instance to an equivalent 32-bit unsigned integer using the specified cult...
static bool operator<=(DateTime t1, DateTime t2)
Determines whether one specified T:System.DateTime represents a date and time that is the same as or ...
int Millisecond
Gets the milliseconds component of the date represented by this instance.
DayOfWeek
Specifies the day of the week.
virtual DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond)
Returns a T:System.DateTime that is set to the specified date and time in the current era.
string [] GetDateTimeFormats()
Converts the value of this instance to all the string representations supported by the standard date ...
long Ticks
Gets the number of ticks that represent the date and time of this instance.
DateTime(int year, int month, int day, int hour, int minute, int second, int millisecond)
Initializes a new instance of the T:System.DateTime structure to the specified year,...
bool MoveNext()
Updates the enumerator to the next item.
static bool TryParse(string s, IFormatProvider provider, DateTimeStyles styles, out DateTime result)
Converts the specified string representation of a date and time to its T:System.DateTime equivalent u...