11 [__DynamicallyInvokable]
14 internal const long MaxOffset = 504000000000
L;
16 internal const long MinOffset = -504000000000
L;
18 private const long UnixEpochTicks = 621355968000000000
L;
20 private const long UnixEpochSeconds = 62135596800
L;
22 private const long UnixEpochMilliseconds = 62135596800000
L;
25 [__DynamicallyInvokable]
31 [__DynamicallyInvokable]
36 private short m_offsetMinutes;
40 [__DynamicallyInvokable]
43 [__DynamicallyInvokable]
52 [__DynamicallyInvokable]
55 [__DynamicallyInvokable]
64 [__DynamicallyInvokable]
67 [__DynamicallyInvokable]
76 [__DynamicallyInvokable]
79 [__DynamicallyInvokable]
88 [__DynamicallyInvokable]
91 [__DynamicallyInvokable]
102 [__DynamicallyInvokable]
105 [__DynamicallyInvokable]
108 return ClockDateTime.
Date;
114 [__DynamicallyInvokable]
117 [__DynamicallyInvokable]
120 return ClockDateTime.
Day;
126 [__DynamicallyInvokable]
129 [__DynamicallyInvokable]
138 [__DynamicallyInvokable]
141 [__DynamicallyInvokable]
150 [__DynamicallyInvokable]
153 [__DynamicallyInvokable]
156 return ClockDateTime.
Hour;
162 [__DynamicallyInvokable]
165 [__DynamicallyInvokable]
174 [__DynamicallyInvokable]
177 [__DynamicallyInvokable]
180 return ClockDateTime.
Minute;
186 [__DynamicallyInvokable]
189 [__DynamicallyInvokable]
192 return ClockDateTime.
Month;
198 [__DynamicallyInvokable]
201 [__DynamicallyInvokable]
204 return new TimeSpan(0, m_offsetMinutes, 0);
210 [__DynamicallyInvokable]
213 [__DynamicallyInvokable]
216 return ClockDateTime.
Second;
222 [__DynamicallyInvokable]
225 [__DynamicallyInvokable]
228 return ClockDateTime.
Ticks;
234 [__DynamicallyInvokable]
237 [__DynamicallyInvokable]
246 [__DynamicallyInvokable]
249 [__DynamicallyInvokable]
258 [__DynamicallyInvokable]
261 [__DynamicallyInvokable]
264 return ClockDateTime.
Year;
276 [__DynamicallyInvokable]
279 m_offsetMinutes = ValidateOffset(offset);
281 m_dateTime = ValidateDate(dateTime, offset);
287 [__DynamicallyInvokable]
291 m_offsetMinutes = ValidateOffset(offset);
292 m_dateTime = ValidateDate(dateTime, offset);
305 [__DynamicallyInvokable]
310 if (offset !=
TimeZoneInfo.GetLocalUtcOffset(dateTime, TimeZoneInfoOptions.NoThrowOnInvalidTime))
319 m_offsetMinutes = ValidateOffset(offset);
320 m_dateTime = ValidateDate(dateTime, offset);
341 [__DynamicallyInvokable]
344 m_offsetMinutes = ValidateOffset(offset);
345 m_dateTime = ValidateDate(
new DateTime(year, month, day, hour, minute, second), offset);
368 [__DynamicallyInvokable]
371 m_offsetMinutes = ValidateOffset(offset);
372 m_dateTime = ValidateDate(
new DateTime(year, month, day, hour, minute, second, millisecond), offset);
400 m_offsetMinutes = ValidateOffset(offset);
401 m_dateTime = ValidateDate(
new DateTime(year, month, day, hour, minute, second, millisecond, calendar), offset);
411 [__DynamicallyInvokable]
421 [__DynamicallyInvokable]
431 [__DynamicallyInvokable]
441 [__DynamicallyInvokable]
451 [__DynamicallyInvokable]
461 [__DynamicallyInvokable]
471 [__DynamicallyInvokable]
481 [__DynamicallyInvokable]
491 [__DynamicallyInvokable]
501 [__DynamicallyInvokable]
514 [__DynamicallyInvokable]
523 [__DynamicallyInvokable]
536 if (utcDateTime2 > utcDateTime)
540 if (utcDateTime2 < utcDateTime)
550 [__DynamicallyInvokable]
555 if (utcDateTime2 > utcDateTime)
559 if (utcDateTime2 < utcDateTime)
570 [__DynamicallyInvokable]
584 [__DynamicallyInvokable]
594 [__DynamicallyInvokable]
597 if (ClockDateTime == other.ClockDateTime &&
Offset == other.
Offset)
599 return ClockDateTime.
Kind == other.ClockDateTime.
Kind;
609 [__DynamicallyInvokable]
621 [__DynamicallyInvokable]
633 [__DynamicallyInvokable]
636 if (seconds < -62135596800L || seconds > 253402300799
L)
640 long ticks = seconds * 10000000 + 621355968000000000
L;
650 [__DynamicallyInvokable]
653 if (milliseconds < -62135596800000L || milliseconds > 253402300799999
L)
657 long ticks = milliseconds * 10000 + 621355968000000000
L;
667 m_offsetMinutes = ValidateOffset(
Offset);
668 m_dateTime = ValidateDate(ClockDateTime,
Offset);
687 info.AddValue(
"DateTime", m_dateTime);
688 info.AddValue(
"OffsetMinutes", m_offsetMinutes);
698 m_offsetMinutes = (short)info.GetValue(
"OffsetMinutes", typeof(
short));
703 [__DynamicallyInvokable]
718 [__DynamicallyInvokable]
735 [__DynamicallyInvokable]
755 [__DynamicallyInvokable]
758 styles = ValidateStyles(styles,
"styles");
777 [__DynamicallyInvokable]
798 [__DynamicallyInvokable]
801 styles = ValidateStyles(styles,
"styles");
820 [__DynamicallyInvokable]
823 styles = ValidateStyles(styles,
"styles");
831 [__DynamicallyInvokable]
841 [__DynamicallyInvokable]
850 [__DynamicallyInvokable]
858 [__DynamicallyInvokable]
862 return num - 62135596800
L;
867 [__DynamicallyInvokable]
871 return num - 62135596800000
L;
876 [__DynamicallyInvokable]
890 [__DynamicallyInvokable]
902 [__DynamicallyInvokable]
912 [__DynamicallyInvokable]
925 [__DynamicallyInvokable]
933 [__DynamicallyInvokable]
944 [__DynamicallyInvokable]
965 [__DynamicallyInvokable]
968 styles = ValidateStyles(styles,
"styles");
971 bool result3 = DateTimeParse.
TryParse(input,
DateTimeFormatInfo.GetInstance(formatProvider), styles, out result2, out offset);
988 [__DynamicallyInvokable]
991 styles = ValidateStyles(styles,
"styles");
1011 [__DynamicallyInvokable]
1014 styles = ValidateStyles(styles,
"styles");
1017 bool result3 = DateTimeParse.TryParseExactMultiple(input, formats,
DateTimeFormatInfo.GetInstance(formatProvider), styles, out result2, out offset);
1022 private static short ValidateOffset(
TimeSpan offset)
1024 long ticks = offset.
Ticks;
1025 if (ticks % 600000000 != 0
L)
1029 if (ticks < -504000000000L || ticks > 504000000000
L)
1031 throw new ArgumentOutOfRangeException(
"offset", Environment.GetResourceString(
"Argument_OffsetOutOfRange"));
1033 return (
short)(offset.
Ticks / 600000000);
1038 long num = dateTime.
Ticks - offset.Ticks;
1039 if (num < 0 || num > 3155378975999999999
L)
1041 throw new ArgumentOutOfRangeException(
"offset", Environment.GetResourceString(
"Argument_UTCOutOfRange"));
1050 throw new ArgumentException(Environment.GetResourceString(
"Argument_InvalidDateTimeStyles"), parameterName);
1054 throw new ArgumentException(Environment.GetResourceString(
"Argument_ConflictingDateTimeStyles"), parameterName);
1058 throw new ArgumentException(Environment.GetResourceString(
"Argument_DateTimeOffsetInvalidDateTimeStyles"), parameterName);
1069 [__DynamicallyInvokable]
1080 [__DynamicallyInvokable]
1091 [__DynamicallyInvokable]
1101 [__DynamicallyInvokable]
1112 [__DynamicallyInvokable]
1123 [__DynamicallyInvokable]
1134 [__DynamicallyInvokable]
1145 [__DynamicallyInvokable]
1156 [__DynamicallyInvokable]
1167 [__DynamicallyInvokable]
Represents any time zone in the world.
DateTime AddYears(int value)
Returns a new T:System.DateTime that adds the specified number of years to the value of this instance...
int Day
Gets the day of the month represented by the current T:System.DateTimeOffset object.
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 bool TryParseExact(string input, string format, IFormatProvider formatProvider, DateTimeStyles styles, out DateTimeOffset result)
Converts the specified string representation of a date and time to its T:System.DateTimeOffset equiva...
static DateTimeOffset Parse(string input, IFormatProvider formatProvider)
Converts the specified string representation of a date and time to its T:System.DateTimeOffset equiva...
DateTimeOffset Subtract(TimeSpan value)
Subtracts a specified time interval from the current T:System.DateTimeOffset object.
Represents a point in time, typically expressed as a date and time of day, relative to Coordinated Un...
static DateTime FromFileTime(long fileTime)
Converts the specified Windows file time to an equivalent local time.
static readonly DateTimeOffset MinValue
Represents the earliest possible T:System.DateTimeOffset value. This field is read-only.
DateTimeOffset ToOffset(TimeSpan offset)
Converts the value of the current T:System.DateTimeOffset object to the date and time specified by an...
DateTimeOffset(long ticks, TimeSpan offset)
Initializes a new instance of the T:System.DateTimeOffset structure using the specified number of tic...
long ToFileTime()
Converts the value of the current T:System.DateTimeOffset object to a Windows file time.
Indicates that a class is to be notified when deserialization of the entire object graph has been com...
LayoutKind
Controls the layout of an object when exported to unmanaged code.
int Minute
Gets the minute component of the time represented by the current T:System.DateTimeOffset object.
static DateTimeOffset Parse(string input, IFormatProvider formatProvider, DateTimeStyles styles)
Converts the specified string representation of a date and time to its T:System.DateTimeOffset equiva...
static DateTimeOffset FromFileTime(long fileTime)
Converts the specified Windows file time to an equivalent local time.
The exception that is thrown when the value of an argument is outside the allowable range of values a...
long ToUnixTimeMilliseconds()
Returns the number of milliseconds that have elapsed since 1970-01-01T00:00:00.000Z.
static bool TryParseExact(string input, string format, IFormatProvider formatProvider, out TimeSpan result)
Converts the string representation of a time interval to its T:System.TimeSpan equivalent by using th...
int CompareTo(DateTimeOffset other)
Compares the current T:System.DateTimeOffset object to a specified T:System.DateTimeOffset object and...
static DateTimeOffset operator+(DateTimeOffset dateTimeOffset, TimeSpan timeSpan)
Adds a specified time interval to a T:System.DateTimeOffset object that has a specified date and time...
DateTimeOffset(int year, int month, int day, int hour, int minute, int second, int millisecond, Calendar calendar, TimeSpan offset)
Initializes a new instance of the T:System.DateTimeOffset structure using the specified year,...
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 ....
DayOfWeek DayOfWeek
Gets the day of the week represented by this instance.
TimeSpan TimeOfDay
Gets the time of day for the current T:System.DateTimeOffset object.
override bool Equals(object obj)
Determines whether a T:System.DateTimeOffset object represents the same point in time as a specified ...
Describes the source and destination of a given serialized stream, and provides an additional caller-...
Defines a generalized type-specific comparison method that a value type or class implements to order ...
DateTimeOffset ToUniversalTime()
Converts the current T:System.DateTimeOffset object to a T:System.DateTimeOffset value that represent...
int Second
Gets the seconds component of the date represented by this instance.
DateTimeOffset AddMonths(int months)
Returns a new T:System.DateTimeOffset object that adds a specified number of months to the value of t...
DateTime ToLocalTime()
Converts the value of the current T:System.DateTime object to local time.
long Ticks
Gets the number of ticks that represents the date and time of the current T:System....
int Hour
Gets the hour component of the date represented by this instance.
static DateTimeOffset FromUnixTimeSeconds(long seconds)
Converts a Unix time expressed as the number of seconds that have elapsed since 1970-01-01T00:00:00Z ...
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.
static bool TryParseExact(string input, string[] formats, IFormatProvider formatProvider, DateTimeStyles styles, out DateTimeOffset result)
Converts the specified string representation of a date and time to its T:System.DateTimeOffset equiva...
int Year
Gets the year component of the date represented by the current T:System.DateTimeOffset object.
static bool TryParse(string input, out DateTimeOffset result)
Tries to converts a specified string representation of a date and time to its T:System....
DateTimeOffset(DateTime dateTime, TimeSpan offset)
Initializes a new instance of the T:System.DateTimeOffset structure using the specified T:System....
DateTimeOffset AddHours(double hours)
Returns a new T:System.DateTimeOffset object that adds a specified number of whole and fractional hou...
DateTimeKind Kind
Gets a value that indicates whether the time represented by this instance is based on local time,...
DateTime DateTime
Gets a T:System.DateTime value that represents the date and time of the current T:System....
bool Equals(DateTimeOffset other)
Determines whether the current T:System.DateTimeOffset object represents the same point in time as a ...
static TimeSpan operator -(DateTimeOffset left, DateTimeOffset right)
Subtracts one T:System.DateTimeOffset object from another and yields a time interval.
TimeSpan Offset
Gets the time's offset from Coordinated Universal Time (UTC).
void OnDeserialization(object sender)
Runs when the entire object graph has been deserialized.
static bool TryParse(string input, IFormatProvider formatProvider, DateTimeStyles styles, out DateTimeOffset result)
Tries to convert a specified string representation of a date and time to its T:System....
string ToString(IFormatProvider formatProvider)
Converts the value of the current T:System.DateTimeOffset object to its equivalent string representat...
DateTimeOffset(DateTime dateTime)
Initializes a new instance of the T:System.DateTimeOffset structure using the 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.
DateTime AddMonths(int months)
Returns a new T:System.DateTime that adds the specified number of months to the value of this instanc...
int Minute
Gets the minute component of the date represented by this instance.
static bool TryParse(string s, out TimeSpan result)
Converts the string representation of a time interval to its T:System.TimeSpan equivalent and returns...
DateTime Date
Gets the date component of this instance.
DateTime Date
Gets a T:System.DateTime value that represents the date component of the current T:System....
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.
DateTimeOffset AddTicks(long ticks)
Returns a new T:System.DateTimeOffset object that adds a specified number of ticks to the value of th...
override bool Equals(object value)
Returns a value indicating whether this instance is equal to a specified object.
DateTime LocalDateTime
Gets a T:System.DateTime value that represents the local date and time of the current T:System....
static DateTimeOffset ParseExact(string input, string format, IFormatProvider formatProvider)
Converts the specified string representation of a date and time to its T:System.DateTimeOffset equiva...
DateTimeOffset AddSeconds(double seconds)
Returns a new T:System.DateTimeOffset object that adds a specified number of whole and fractional sec...
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 bool operator >=(DateTimeOffset left, DateTimeOffset right)
Determines whether one specified T:System.DateTimeOffset object is greater than or equal to a second ...
static DateTime UtcNow
Gets a T:System.DateTime object that is set to the current date and time on this computer,...
static DateTimeOffset UtcNow
Gets a T:System.DateTimeOffset object whose date and time are set to the current Coordinated Universa...
static readonly TimeSpan Zero
Represents the zero T:System.TimeSpan value. This field is read-only.
static bool Equals(DateTimeOffset first, DateTimeOffset second)
Determines whether two specified T:System.DateTimeOffset objects represent the same point in time.
int Day
Gets the day of the month represented by this instance.
override string ToString()
Converts the value of the current T:System.DateTimeOffset object to its equivalent string representat...
static DateTimeOffset FromUnixTimeMilliseconds(long milliseconds)
Converts a Unix time expressed as the number of milliseconds that have elapsed since 1970-01-01T00:00...
string ToString(string format, IFormatProvider formatProvider)
Converts the value of the current T:System.DateTimeOffset object to its equivalent string representat...
DateTimeOffset AddMinutes(double minutes)
Returns a new T:System.DateTimeOffset object that adds a specified number of whole and fractional min...
int Millisecond
Gets the millisecond component of the time represented by the current T:System.DateTimeOffset object.
static bool operator==(DateTimeOffset left, DateTimeOffset right)
Determines whether two specified T:System.DateTimeOffset objects represent the same point in time.
Stores all the data needed to serialize or deserialize an object. This class cannot be inherited.
int Hour
Gets the hour component of the time represented by the current T:System.DateTimeOffset object.
int DayOfYear
Gets the day of the year represented by the current T:System.DateTimeOffset object.
The exception that is thrown when one of the arguments provided to a method is not valid.
static DateTimeOffset ParseExact(string input, string format, IFormatProvider formatProvider, DateTimeStyles styles)
Converts the specified string representation of a date and time to its T:System.DateTimeOffset equiva...
DateTimeOffset AddDays(double days)
Returns a new T:System.DateTimeOffset object that adds a specified number of whole and fractional day...
static DateTimeOffset operator -(DateTimeOffset dateTimeOffset, TimeSpan timeSpan)
Subtracts a specified time interval from a specified date and time, and yields a new date and time.
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...
static DateTimeOffset ParseExact(string input, string[] formats, IFormatProvider formatProvider, DateTimeStyles styles)
Converts the specified string representation of a date and time to its T:System.DateTimeOffset equiva...
TimeSpan Subtract(DateTimeOffset value)
Subtracts a T:System.DateTimeOffset value that represents a specific date and time from the current T...
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...
DateTimeOffset(int year, int month, int day, int hour, int minute, int second, int millisecond, TimeSpan offset)
Initializes a new instance of the T:System.DateTimeOffset structure using the specified year,...
DateTimeKind
Specifies whether a T:System.DateTime object represents a local time, a Coordinated Universal Time (U...
static readonly DateTimeOffset MaxValue
Represents the greatest possible value of T:System.DateTimeOffset. This field is read-only.
DateTime AddHours(double value)
Returns a new T:System.DateTime that adds the specified number of hours to the value of this instance...
bool EqualsExact(DateTimeOffset other)
Determines whether the current T:System.DateTimeOffset object represents the same time and has the sa...
DateTimeOffset Add(TimeSpan timeSpan)
Returns a new T:System.DateTimeOffset object that adds a specified time interval to the value of this...
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 Now
Gets a T:System.DateTime object that is set to the current date and time on this computer,...
DateTimeOffset AddYears(int years)
Returns a new T:System.DateTimeOffset object that adds a specified number of years to the value of th...
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 bool operator >(DateTimeOffset left, DateTimeOffset right)
Determines whether one specified T:System.DateTimeOffset object is greater than (or later than) a sec...
DateTime AddMinutes(double value)
Returns a new T:System.DateTime that adds the specified number of minutes to the value of this instan...
DateTimeOffset ToLocalTime()
Converts the current T:System.DateTimeOffset object to a T:System.DateTimeOffset object that represen...
string ToString(string format)
Converts the value of the current T:System.DateTimeOffset object to its equivalent string representat...
static bool operator<=(DateTimeOffset left, DateTimeOffset right)
Determines whether one specified T:System.DateTimeOffset object is less than a second specified T:Sys...
static DateTimeOffset Now
Gets a T:System.DateTimeOffset object that is set to the current date and time on the current compute...
static bool operator<(DateTimeOffset left, DateTimeOffset right)
Determines whether one specified T:System.DateTimeOffset object is less than a second specified T:Sys...
static DateTimeOffset Parse(string input)
Converts the specified string representation of a date, time, and offset to its T:System....
DateTime AddSeconds(double value)
Returns a new T:System.DateTime that adds the specified number of seconds to the value of this instan...
DateTimeOffset AddMilliseconds(double milliseconds)
Returns a new T:System.DateTimeOffset object that adds a specified number of milliseconds to the valu...
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...
DateTime UtcDateTime
Gets a T:System.DateTime value that represents the Coordinated Universal Time (UTC) date and time of ...
DateTime AddTicks(long value)
Returns a new T:System.DateTime that adds the specified number of ticks to the value of this instance...
int Millisecond
Gets the milliseconds component of the date represented by this instance.
DayOfWeek
Specifies the day of the week.
override int GetHashCode()
Returns the hash code for the current T:System.DateTimeOffset object.
DateTimeOffset(int year, int month, int day, int hour, int minute, int second, TimeSpan offset)
Initializes a new instance of the T:System.DateTimeOffset structure using the specified year,...
long Ticks
Gets the number of ticks that represent the date and time of this instance.
int Second
Gets the second component of the clock time represented by the current T:System.DateTimeOffset object...
static bool operator !=(DateTimeOffset left, DateTimeOffset right)
Determines whether two specified T:System.DateTimeOffset objects refer to different points in time.
long ToUnixTimeSeconds()
Returns the number of seconds that have elapsed since 1970-01-01T00:00:00Z.
int Month
Gets the month component of the date represented by the current T:System.DateTimeOffset object.
long UtcTicks
Gets the number of ticks that represents the date and time of the current T:System....
static int Compare(DateTimeOffset first, DateTimeOffset second)
Compares two T:System.DateTimeOffset objects and indicates whether the first is earlier than the seco...