A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://learn.microsoft.com/en-us/dotnet/api/system.datetimeoffset below:

DateTimeOffset Struct (System) | Microsoft Learn

DateTimeOffset Struct Definition

Represents a point in time, typically expressed as a date and time of day, relative to Coordinated Universal Time (UTC).

public value class DateTimeOffset : IComparable, IComparable<DateTimeOffset>, IEquatable<DateTimeOffset>, IFormattable
public value class DateTimeOffset : IComparable, IComparable<DateTimeOffset>, IEquatable<DateTimeOffset>, IParsable<DateTimeOffset>, ISpanFormattable, ISpanParsable<DateTimeOffset>, IUtf8SpanFormattable, System::Runtime::Serialization::IDeserializationCallback, System::Runtime::Serialization::ISerializable
public value class DateTimeOffset : IComparable, IComparable<DateTimeOffset>, IEquatable<DateTimeOffset>, IFormattable, System::Runtime::Serialization::IDeserializationCallback, System::Runtime::Serialization::ISerializable
public value class DateTimeOffset : IComparable, IComparable<DateTimeOffset>, IEquatable<DateTimeOffset>, ISpanFormattable, System::Runtime::Serialization::IDeserializationCallback, System::Runtime::Serialization::ISerializable
public value class DateTimeOffset : IComparable, IComparable<DateTimeOffset>, IEquatable<DateTimeOffset>, IParsable<DateTimeOffset>, ISpanFormattable, ISpanParsable<DateTimeOffset>, System::Runtime::Serialization::IDeserializationCallback, System::Runtime::Serialization::ISerializable
public struct DateTimeOffset : IComparable, IComparable<DateTimeOffset>, IEquatable<DateTimeOffset>, IFormattable
public readonly struct DateTimeOffset : IComparable, IComparable<DateTimeOffset>, IEquatable<DateTimeOffset>, IParsable<DateTimeOffset>, ISpanFormattable, ISpanParsable<DateTimeOffset>, IUtf8SpanFormattable, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
public readonly struct DateTimeOffset : IComparable, IComparable<DateTimeOffset>, IEquatable<DateTimeOffset>, IFormattable, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
public readonly struct DateTimeOffset : IComparable, IComparable<DateTimeOffset>, IEquatable<DateTimeOffset>, ISpanFormattable, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
public readonly struct DateTimeOffset : IComparable, IComparable<DateTimeOffset>, IEquatable<DateTimeOffset>, IParsable<DateTimeOffset>, ISpanFormattable, ISpanParsable<DateTimeOffset>, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
public struct DateTimeOffset : IComparable, IComparable<DateTimeOffset>, IEquatable<DateTimeOffset>, IFormattable, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
[System.Serializable]
public struct DateTimeOffset : IComparable, IComparable<DateTimeOffset>, IEquatable<DateTimeOffset>, IFormattable, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
type DateTimeOffset = struct
    interface IFormattable
type DateTimeOffset = struct
    interface IFormattable
    interface IParsable<DateTimeOffset>
    interface ISpanFormattable
    interface ISpanParsable<DateTimeOffset>
    interface IUtf8SpanFormattable
    interface IDeserializationCallback
    interface ISerializable
type DateTimeOffset = struct
    interface IFormattable
    interface IDeserializationCallback
    interface ISerializable
type DateTimeOffset = struct
    interface ISpanFormattable
    interface IFormattable
    interface IDeserializationCallback
    interface ISerializable
type DateTimeOffset = struct
    interface IFormattable
    interface IParsable<DateTimeOffset>
    interface ISpanFormattable
    interface ISpanParsable<DateTimeOffset>
    interface IDeserializationCallback
    interface ISerializable
type DateTimeOffset = struct
    interface IFormattable
    interface IParsable<DateTimeOffset>
    interface ISpanFormattable
    interface ISpanParsable<DateTimeOffset>
    interface IDeserializationCallback
    interface ISerializable
    interface IUtf8SpanFormattable
[<System.Serializable>]
type DateTimeOffset = struct
    interface IFormattable
    interface ISerializable
    interface IDeserializationCallback
Public Structure DateTimeOffset
Implements IComparable, IComparable(Of DateTimeOffset), IEquatable(Of DateTimeOffset), IFormattable
Public Structure DateTimeOffset
Implements IComparable, IComparable(Of DateTimeOffset), IDeserializationCallback, IEquatable(Of DateTimeOffset), IParsable(Of DateTimeOffset), ISerializable, ISpanFormattable, ISpanParsable(Of DateTimeOffset), IUtf8SpanFormattable
Public Structure DateTimeOffset
Implements IComparable, IComparable(Of DateTimeOffset), IDeserializationCallback, IEquatable(Of DateTimeOffset), IFormattable, ISerializable
Public Structure DateTimeOffset
Implements IComparable, IComparable(Of DateTimeOffset), IDeserializationCallback, IEquatable(Of DateTimeOffset), ISerializable, ISpanFormattable
Public Structure DateTimeOffset
Implements IComparable, IComparable(Of DateTimeOffset), IDeserializationCallback, IEquatable(Of DateTimeOffset), IParsable(Of DateTimeOffset), ISerializable, ISpanFormattable, ISpanParsable(Of DateTimeOffset)
Inheritance
Attributes
Implements

The DateTimeOffset structure includes a DateTime value, together with an Offset property that defines the difference between the current DateTimeOffset instance's date and time and Coordinated Universal Time (UTC). Because it exactly defines a date and time relative to UTC, the DateTimeOffset structure does not include a Kind member, as the DateTime structure does. It represents dates and times with values whose UTC ranges from 12:00:00 midnight, January 1, 0001 Anno Domini (Common Era), to 11:59:59 P.M., December 31, 9999 A.D. (C.E.).

The time component of a DateTimeOffset value is measured in 100-nanosecond units called ticks, and a particular date is the number of ticks since 12:00 midnight, January 1, 0001 A.D. (C.E.) in the GregorianCalendar calendar. A DateTimeOffset value is always expressed in the context of an explicit or default calendar. Ticks that are attributable to leap seconds are not included in the total number of ticks.

Although a DateTimeOffset value includes an offset, it is not a fully time zone-aware data structure. While an offset from UTC is one characteristic of a time zone, it does not unambiguously identify a time zone. Not only do multiple time zones share the same offset from UTC, but the offset of a single time zone changes if it observes daylight saving time. This means that, as soon as a DateTimeOffset value is disassociated from its time zone, it can no longer be unambiguously linked back to its original time zone.

Because DateTimeOffset is a structure, a DateTimeOffset object that has been declared but not otherwise initialized contains the default values for each of its member fields. This means that its DateTime property is set to DateTimeOffset.MinValue and its Offset property is set to TimeSpan.Zero.

You can create a new DateTimeOffset value by calling any of the overloads of its constructor, which are similar to the overloaded constructors for the DateTime structure. You can also create a new DateTimeOffset value by assigning it a DateTime value. This is an implicit conversion; it does not require a casting operator (in C#) or call to a conversion method (in Visual Basic). You can also initialize a DateTimeOffset value from the string representation of a date and time by calling a number of static string parsing methods, which include Parse, ParseExact, TryParse, and TryParseExact.

The members of the DateTimeOffset structure provide functionality in the following areas:

Constructors DateTimeOffset(DateOnly, TimeOnly, TimeSpan)

Initializes a new instance of the DateTimeOffset structure using the specified date, time, and offset.

DateTimeOffset(DateTime, TimeSpan)

Initializes a new instance of the DateTimeOffset structure using the specified DateTime value and offset.

DateTimeOffset(DateTime)

Initializes a new instance of the DateTimeOffset structure using the specified DateTime value.

DateTimeOffset(Int32, Int32, Int32, Int32, Int32, Int32, Int32, Calendar, TimeSpan)

Initializes a new instance of the DateTimeOffset structure using the specified year, month, day, hour, minute, second, millisecond, and offset of a specified calendar.

DateTimeOffset(Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Calendar, TimeSpan)

Initializes a new instance of the DateTimeOffset structure using the specified year, month, day, hour, minute, second, millisecond, microsecond and offset.

DateTimeOffset(Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, TimeSpan)

Initializes a new instance of the DateTimeOffset structure using the specified year, month, day, hour, minute, second, millisecond, microsecond and offset.

DateTimeOffset(Int32, Int32, Int32, Int32, Int32, Int32, Int32, TimeSpan)

Initializes a new instance of the DateTimeOffset structure using the specified year, month, day, hour, minute, second, millisecond, and offset.

DateTimeOffset(Int32, Int32, Int32, Int32, Int32, Int32, TimeSpan)

Initializes a new instance of the DateTimeOffset structure using the specified year, month, day, hour, minute, second, and offset.

DateTimeOffset(Int64, TimeSpan)

Initializes a new instance of the DateTimeOffset structure using the specified number of ticks and offset.

Fields MaxValue

Represents the greatest possible value of DateTimeOffset. This field is read-only.

MinValue

Represents the earliest possible DateTimeOffset value. This field is read-only.

UnixEpoch

The value of this constant is equivalent to 00:00:00.0000000 UTC, January 1, 1970, in the Gregorian calendar. UnixEpoch defines the point in time when Unix time is equal to 0.

Properties Methods Add(TimeSpan)

Returns a new DateTimeOffset object that adds a specified time interval to the value of this instance.

AddDays(Double)

Returns a new DateTimeOffset object that adds a specified number of whole and fractional days to the value of this instance.

AddHours(Double)

Returns a new DateTimeOffset object that adds a specified number of whole and fractional hours to the value of this instance.

AddMicroseconds(Double)

Returns a new DateTimeOffset object that adds a specified number of microseconds to the value of this instance.

AddMilliseconds(Double)

Returns a new DateTimeOffset object that adds a specified number of milliseconds to the value of this instance.

AddMinutes(Double)

Returns a new DateTimeOffset object that adds a specified number of whole and fractional minutes to the value of this instance.

AddMonths(Int32)

Returns a new DateTimeOffset object that adds a specified number of months to the value of this instance.

AddSeconds(Double)

Returns a new DateTimeOffset object that adds a specified number of whole and fractional seconds to the value of this instance.

AddTicks(Int64)

Returns a new DateTimeOffset object that adds a specified number of ticks to the value of this instance.

AddYears(Int32)

Returns a new DateTimeOffset object that adds a specified number of years to the value of this instance.

Compare(DateTimeOffset, DateTimeOffset)

Compares two DateTimeOffset objects and indicates whether the first is earlier than the second, equal to the second, or later than the second.

CompareTo(DateTimeOffset)

Compares the current DateTimeOffset object to a specified DateTimeOffset object and indicates whether the current object is earlier than, the same as, or later than the second DateTimeOffset object.

Deconstruct(DateOnly, TimeOnly, TimeSpan)

Deconstructs this DateTimeOffset instance by DateOnly, TimeOnly, and TimeSpan.

Equals(DateTimeOffset, DateTimeOffset)

Determines whether two specified DateTimeOffset objects represent the same point in time.

Equals(DateTimeOffset)

Determines whether the current DateTimeOffset object represents the same point in time as a specified DateTimeOffset object.

Equals(Object)

Determines whether a DateTimeOffset object represents the same point in time as a specified object.

EqualsExact(DateTimeOffset)

Determines whether the current DateTimeOffset object represents the same time and has the same offset as a specified DateTimeOffset object.

FromFileTime(Int64)

Converts the specified Windows file time to an equivalent local time.

FromUnixTimeMilliseconds(Int64)

Converts a Unix time expressed as the number of milliseconds that have elapsed since 1970-01-01T00:00:00Z to a DateTimeOffset value.

FromUnixTimeSeconds(Int64)

Converts a Unix time expressed as the number of seconds that have elapsed since 1970-01-01T00:00:00Z to a DateTimeOffset value.

GetHashCode()

Returns the hash code for the current DateTimeOffset object.

Parse(ReadOnlySpan<Char>, IFormatProvider, DateTimeStyles)

Converts the specified span representation of a date and time to its DateTimeOffset equivalent using the specified culture-specific format information and formatting style.

Parse(ReadOnlySpan<Char>, IFormatProvider)

Parses a span of characters into a value.

Parse(String, IFormatProvider, DateTimeStyles)

Converts the specified string representation of a date and time to its DateTimeOffset equivalent using the specified culture-specific format information and formatting style.

Parse(String, IFormatProvider)

Converts the specified string representation of a date and time to its DateTimeOffset equivalent using the specified culture-specific format information.

Parse(String)

Converts the specified string representation of a date, time, and offset to its DateTimeOffset equivalent.

ParseExact(ReadOnlySpan<Char>, ReadOnlySpan<Char>, IFormatProvider, DateTimeStyles)

Converts a character span that represents a date and time to its DateTimeOffset equivalent using the specified format, culture-specific format information, and style. The format of the date and time representation must match the specified format exactly.

ParseExact(ReadOnlySpan<Char>, String[], IFormatProvider, DateTimeStyles)

Converts a character span that contains the string representation of a date and time to its DateTimeOffset equivalent using the specified formats, culture-specific format information, and style. The format of the date and time representation must match one of the specified formats exactly.

ParseExact(String, String, IFormatProvider, DateTimeStyles)

Converts the specified string representation of a date and time to its DateTimeOffset equivalent using the specified format, culture-specific format information, and style. The format of the string representation must match the specified format exactly.

ParseExact(String, String, IFormatProvider)

Converts the specified string representation of a date and time to its DateTimeOffset equivalent using the specified format and culture-specific format information. The format of the string representation must match the specified format exactly.

ParseExact(String, String[], IFormatProvider, DateTimeStyles)

Converts the specified string representation of a date and time to its DateTimeOffset equivalent using the specified formats, culture-specific format information, and style. The format of the string representation must match one of the specified formats exactly.

Subtract(DateTimeOffset)

Subtracts a DateTimeOffset value that represents a specific date and time from the current DateTimeOffset object.

Subtract(TimeSpan)

Subtracts a specified time interval from the current DateTimeOffset object.

ToFileTime()

Converts the value of the current DateTimeOffset object to a Windows file time.

ToLocalTime()

Converts the current DateTimeOffset object to a DateTimeOffset object that represents the local time.

ToOffset(TimeSpan)

Converts the value of the current DateTimeOffset object to the date and time specified by an offset value.

ToString()

Converts the value of the current DateTimeOffset object to its equivalent string representation.

ToString(IFormatProvider)

Converts the value of the current DateTimeOffset object to its equivalent string representation using the specified culture-specific formatting information.

ToString(String, IFormatProvider)

Converts the value of the current DateTimeOffset object to its equivalent string representation using the specified format and culture-specific format information.

ToString(String)

Converts the value of the current DateTimeOffset object to its equivalent string representation using the specified format.

ToUniversalTime()

Converts the current DateTimeOffset object to a DateTimeOffset value that represents the Coordinated Universal Time (UTC).

ToUnixTimeMilliseconds()

Returns the number of milliseconds that have elapsed since 1970-01-01T00:00:00.000Z.

ToUnixTimeSeconds()

Returns the number of seconds that have elapsed since 1970-01-01T00:00:00Z.

TryFormat(Span<Byte>, Int32, ReadOnlySpan<Char>, IFormatProvider)

Tries to format the value of the current instance as UTF-8 into the provided span of bytes.

TryFormat(Span<Char>, Int32, ReadOnlySpan<Char>, IFormatProvider)

Tries to format the value of the current datetime offset instance into the provided span of characters.

TryParse(ReadOnlySpan<Char>, DateTimeOffset)

Tries to convert a specified span representation of a date and time to its DateTimeOffset equivalent, and returns a value that indicates whether the conversion succeeded.

TryParse(ReadOnlySpan<Char>, IFormatProvider, DateTimeOffset)

Tries to parse a span of characters into a value.

TryParse(ReadOnlySpan<Char>, IFormatProvider, DateTimeStyles, DateTimeOffset)

Tries to convert a specified span representation of a date and time to its DateTimeOffset equivalent, and returns a value that indicates whether the conversion succeeded.

TryParse(String, DateTimeOffset)

Tries to converts a specified string representation of a date and time to its DateTimeOffset equivalent, and returns a value that indicates whether the conversion succeeded.

TryParse(String, IFormatProvider, DateTimeOffset)

Tries to parse a string into a value.

TryParse(String, IFormatProvider, DateTimeStyles, DateTimeOffset)

Tries to convert a specified string representation of a date and time to its DateTimeOffset equivalent, and returns a value that indicates whether the conversion succeeded.

TryParseExact(ReadOnlySpan<Char>, ReadOnlySpan<Char>, IFormatProvider, DateTimeStyles, DateTimeOffset)

Converts the representation of a date and time in a character span to its DateTimeOffset equivalent using the specified format, culture-specific format information, and style. The format of the date and time representation must match the specified format exactly.

TryParseExact(ReadOnlySpan<Char>, String[], IFormatProvider, DateTimeStyles, DateTimeOffset)

Converts the representation of a date and time in a character span to its DateTimeOffset equivalent using the specified formats, culture-specific format information, and style. The format of the date and time representation must match one of the specified formats exactly.

TryParseExact(String, String, IFormatProvider, DateTimeStyles, DateTimeOffset)

Converts the specified string representation of a date and time to its DateTimeOffset equivalent using the specified format, culture-specific format information, and style. The format of the string representation must match the specified format exactly.

TryParseExact(String, String[], IFormatProvider, DateTimeStyles, DateTimeOffset)

Converts the specified string representation of a date and time to its DateTimeOffset equivalent using the specified array of formats, culture-specific format information, and style. The format of the string representation must match one of the specified formats exactly.

Operators Addition(DateTimeOffset, TimeSpan)

Adds a specified time interval to a DateTimeOffset object that has a specified date and time, and yields a DateTimeOffset object that has new a date and time.

Equality(DateTimeOffset, DateTimeOffset)

Determines whether two specified DateTimeOffset objects represent the same point in time.

GreaterThan(DateTimeOffset, DateTimeOffset)

Determines whether one specified DateTimeOffset object is greater than (or later than) a second specified DateTimeOffset object.

GreaterThanOrEqual(DateTimeOffset, DateTimeOffset)

Determines whether one specified DateTimeOffset object is greater than or equal to a second specified DateTimeOffset object.

Implicit(DateTime to DateTimeOffset)

Defines an implicit conversion of a DateTime object to a DateTimeOffset object.

Inequality(DateTimeOffset, DateTimeOffset)

Determines whether two specified DateTimeOffset objects refer to different points in time.

LessThan(DateTimeOffset, DateTimeOffset)

Determines whether one specified DateTimeOffset object is less than a second specified DateTimeOffset object.

LessThanOrEqual(DateTimeOffset, DateTimeOffset)

Determines whether one specified DateTimeOffset object is less than a second specified DateTimeOffset object.

Subtraction(DateTimeOffset, DateTimeOffset)

Subtracts one DateTimeOffset object from another and yields a time interval.

Subtraction(DateTimeOffset, TimeSpan)

Subtracts a specified time interval from a specified date and time, and yields a new date and time.

Explicit Interface Implementations See also

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4