DateTimeWithZone StructureDateTimeWithZone StructureDateTimeWithZone Structure

Represents a Gregorian date and time. The corresponding XML Schema type is xs:dateTime.

Syntax

Public NotInheritable  DateTimeWithZone _
        Implements IEquatable(Of DateTimeWithZone)
public sealed  DateTimeWithZone : IEquatable<DateTimeWithZone>
public:
value class DateTimeWithZone sealed : IEquatable<DateTimeWithZone>
 
The DateTimeWithZoneDateTimeWithZoneDateTimeWithZone type exposes the following members.

Constructors

 ConstructorDescription
Public methodDateTimeWithZone (DateTime, TimeSpan?)DateTimeWithZone (Date, Nullable(Of TimeSpan))DateTimeWithZone (DateTime, Nullable<TimeSpan>) Initializes a new instance of the DateTimeWithZoneDateTimeWithZoneDateTimeWithZone structure from the specified DateTimeDateDateTime and TimeSpanTimeSpanTimeSpan time zone.
Public methodDateTimeWithZone (DateTime, TimeZone)DateTimeWithZone (Date, TimeZone)DateTimeWithZone (DateTime, TimeZone^) Initializes a new instance of the DateTimeWithZoneDateTimeWithZoneDateTimeWithZone structure with the specified DateTimeDateDateTime and TimeZoneTimeZoneTimeZone.
Public methodDateTimeWithZone (int, int, int, int, int, decimal, TimeZone?)DateTimeWithZone (Integer, Integer, Integer, Integer, Integer, Decimal, Nullable(Of TimeZone))DateTimeWithZone (int, int, int, int, int, decimal, Nullable<TimeZone>) Initializes a new instance of the DateTimeWithZoneDateTimeWithZoneDateTimeWithZone structure with the specified year, month, day, hour, minute, second and time zone components.
Public methodDateTimeWithZone (long, decimal, TimeZone?)DateTimeWithZone (Long, Decimal, Nullable(Of TimeZone))DateTimeWithZone (long, decimal, Nullable<TimeZone>) Initializes a new instance of the DateTimeWithZoneDateTimeWithZoneDateTimeWithZone structure from the specified number of days past the epoch (0001-01-01) and the specified number of seconds past midnight.
Public methodDateTimeWithZone (DateWithZone, TimeWithZone)DateTimeWithZone (DateWithZone, TimeWithZone)DateTimeWithZone (DateWithZone, TimeWithZone) Initializes a new instance of the DateTimeWithZoneDateTimeWithZoneDateTimeWithZone structure with the specified DateWithZoneDateWithZoneDateWithZone and TimeWithZoneTimeWithZoneTimeWithZone.

Top

Properties

 PropertyDescription
Public propertyDateDateDate Gets the date component of this DateTimeWithZoneDateTimeWithZoneDateTimeWithZone represented as a DateWithZoneDateWithZoneDateWithZone.
Public propertyDayDayDay Gets the day component of this DateTimeWithZoneDateTimeWithZoneDateTimeWithZone.
Public propertyDaysPastEpochDaysPastEpochDaysPastEpoch Gets the number of complete days past the epoch (0001-01-01T00:00:00).
Public propertyGDayGDayGDay Gets the day component of this DateTimeWithZoneDateTimeWithZoneDateTimeWithZone represented as a GDayGDayGDay.
Public propertyGMonthGMonthGMonth Gets the month component of this DateTimeWithZoneDateTimeWithZoneDateTimeWithZone represented as a GMonthGMonthGMonth.
Public propertyGMonthDayGMonthDayGMonthDay Gets the month and day components of this DateTimeWithZoneDateTimeWithZoneDateTimeWithZone represented as a GMonthDayGMonthDayGMonthDay.
Public propertyGYearGYearGYear Gets the year component of this DateTimeWithZoneDateTimeWithZoneDateTimeWithZone represented as a GYearGYearGYear.
Public propertyGYearMonthGYearMonthGYearMonth Gets the year and month components of this DateTimeWithZoneDateTimeWithZoneDateTimeWithZone represented as a GYearMonthGYearMonthGYearMonth.
Public propertyHourHourHour Gets the hour component of this DateTimeWithZoneDateTimeWithZoneDateTimeWithZone.
Public propertyMinuteMinuteMinute Gets the minute component of this DateTimeWithZoneDateTimeWithZoneDateTimeWithZone.
Public propertyMonthMonthMonth Gets the month component of this DateTimeWithZoneDateTimeWithZoneDateTimeWithZone.
Public propertystaticNowNowNow Gets a DateTimeWithZoneDateTimeWithZoneDateTimeWithZone object that is set to the current date and time on this computer expressed in the current time zone of this computer.
Public propertySecondSecondSecond Gets the second component of this DateTimeWithZoneDateTimeWithZoneDateTimeWithZone.
Public propertySecondsPastMidnightSecondsPastMidnightSecondsPastMidnight Gets the number of whole and partial seconds from midnight on this day.
Public propertyTimeTimeTime Gets the time component of this DateTimeWithZoneDateTimeWithZoneDateTimeWithZone represented as a TimeWithZoneTimeWithZoneTimeWithZone.
Public propertyTimeZoneTimeZoneTimeZone Gets the optional time zone component of this DateTimeWithZoneDateTimeWithZoneDateTimeWithZone.
Public propertystaticUtcNowUtcNowUtcNow Gets a DateTimeWithZoneDateTimeWithZoneDateTimeWithZone object that is set to the current date and time on this computer expressed in Coordinated Universal Time (UTC).
Public propertyYearYearYear Gets the year component of this DateTimeWithZoneDateTimeWithZoneDateTimeWithZone.

Top

Methods

 MethodDescription
Public methodstaticAdd (DateTimeWithZone, DayTimeDuration)Add (DateTimeWithZone, DayTimeDuration)Add (DateTimeWithZone, DayTimeDuration) Adds a DayTimeDurationDayTimeDurationDayTimeDuration to a DateTimeWithZoneDateTimeWithZoneDateTimeWithZone.
Public methodstaticAdd (DateTimeWithZone, YearMonthDuration)Add (DateTimeWithZone, YearMonthDuration)Add (DateTimeWithZone, YearMonthDuration) Adds a YearMonthDurationYearMonthDurationYearMonthDuration to a DateTimeWithZoneDateTimeWithZoneDateTimeWithZone.
Public methodstaticAdd (DayTimeDuration, DateTimeWithZone)Add (DayTimeDuration, DateTimeWithZone)Add (DayTimeDuration, DateTimeWithZone) Adds a DayTimeDurationDayTimeDurationDayTimeDuration to a DateTimeWithZoneDateTimeWithZoneDateTimeWithZone.
Public methodstaticAdd (YearMonthDuration, DateTimeWithZone)Add (YearMonthDuration, DateTimeWithZone)Add (YearMonthDuration, DateTimeWithZone) Adds a YearMonthDurationYearMonthDurationYearMonthDuration to a DateTimeWithZoneDateTimeWithZoneDateTimeWithZone.
Public methodAdjustToTimeZoneAdjustToTimeZoneAdjustToTimeZone Adjusts a DateTimeWithZoneDateTimeWithZoneDateTimeWithZone structure to a specific time zone, or to no time zone.
Public methodstaticCompareCompareCompare Compares a DateTimeWithZoneDateTimeWithZoneDateTimeWithZone with another DateTimeWithZoneDateTimeWithZoneDateTimeWithZone.
Public methodEquals (object)Equals (Object)Equals (object^) Determines whether this instance is equal to a specified object. (Overrides ValueType.EqualsValueType.EqualsValueType::Equals)
Public methodEquals (DateTimeWithZone)Equals (DateTimeWithZone)Equals (DateTimeWithZone) Indicates whether this instance is equal to another DateTimeWithZoneDateTimeWithZoneDateTimeWithZone.
Public methodstaticEquals (DateTimeWithZone, DateTimeWithZone, TimeZone)Equals (DateTimeWithZone, DateTimeWithZone, TimeZone)Equals (DateTimeWithZone, DateTimeWithZone, TimeZone) Indicates whether a specified DateTimeWithZoneDateTimeWithZoneDateTimeWithZone is equal to another specified DateTimeWithZoneDateTimeWithZoneDateTimeWithZone given the supplied implicit time zone.
Protected methodObject.FinalizeObject.FinalizeObject::Finalize Allows an objectObjectobject to attempt to free resources and perform other cleanup operations before the objectObjectobject is reclaimed by garbage collection. (Inherited from System.ObjectSystem.ObjectSystem::Object)
Public methodGetHashCodeGetHashCodeGetHashCode Returns the hash code for this instance. (Overrides ValueType.GetHashCodeValueType.GetHashCodeValueType::GetHashCode)
Public methodObject.GetTypeObject.GetTypeObject::GetType Gets the TypeTypeType of the current instance. (Inherited from System.ObjectSystem.ObjectSystem::Object)
Protected methodObject.MemberwiseCloneObject.MemberwiseCloneObject::MemberwiseClone Creates a shallow copy of the current objectObjectobject. (Inherited from System.ObjectSystem.ObjectSystem::Object)
Public methodstaticParseParseParse Converts a lexical representation of an xs:dateTime to its DateTimeWithZoneDateTimeWithZoneDateTimeWithZone equivalent.
Public methodstaticSubtract (DateTimeWithZone, DateTimeWithZone)Subtract (DateTimeWithZone, DateTimeWithZone)Subtract (DateTimeWithZone, DateTimeWithZone) Subtracts a DateTimeWithZoneDateTimeWithZoneDateTimeWithZone from another DateTimeWithZoneDateTimeWithZoneDateTimeWithZone.
Public methodstaticSubtract (DateTimeWithZone, DateTimeWithZone, TimeZone)Subtract (DateTimeWithZone, DateTimeWithZone, TimeZone)Subtract (DateTimeWithZone, DateTimeWithZone, TimeZone) Subtracts a DateTimeWithZoneDateTimeWithZoneDateTimeWithZone value from a DateTimeWithZoneDateTimeWithZoneDateTimeWithZone value in the given time zone.
Public methodstaticSubtract (DateTimeWithZone, DayTimeDuration)Subtract (DateTimeWithZone, DayTimeDuration)Subtract (DateTimeWithZone, DayTimeDuration) Subtracts a DayTimeDurationDayTimeDurationDayTimeDuration from a DateTimeWithZoneDateTimeWithZoneDateTimeWithZone.
Public methodstaticSubtract (DateTimeWithZone, YearMonthDuration)Subtract (DateTimeWithZone, YearMonthDuration)Subtract (DateTimeWithZone, YearMonthDuration) Subtracts a YearMonthDurationYearMonthDurationYearMonthDuration from a DateTimeWithZoneDateTimeWithZoneDateTimeWithZone
Public methodToDateTimeToDateTimeToDateTime Returns the value as a DateTimeDateDateTime instance.
Public methodToString ()ToString ()ToString () Returns the canonical lexical representation of this DateTimeWithZoneDateTimeWithZoneDateTimeWithZone. (Overrides ValueType.ToStringValueType.ToStringValueType::ToString)
Public methodToString (string, CultureInfo)ToString (String, CultureInfo)ToString (String^, CultureInfo^) Converts the value of the current DateTimeWithZoneDateTimeWithZoneDateTimeWithZone object to its equivalent string representation using the specified format and culture-specific format information.
Public methodstaticTryParseTryParseTryParse Converts a lexical representation of an xs:dateTime to its DateTimeWithZoneDateTimeWithZoneDateTimeWithZone equivalent. A return value indicates whether the conversion succeeded or failed.

Top

Operators

 OperatorDescription
Public operatorstaticAddition (DateTimeWithZone, DayTimeDuration)Addition (DateTimeWithZone, DayTimeDuration)Addition (DateTimeWithZone, DayTimeDuration) Adds a DayTimeDurationDayTimeDurationDayTimeDuration to a DateTimeWithZoneDateTimeWithZoneDateTimeWithZone.
Public operatorstaticAddition (DateTimeWithZone, YearMonthDuration)Addition (DateTimeWithZone, YearMonthDuration)Addition (DateTimeWithZone, YearMonthDuration) Adds a YearMonthDurationYearMonthDurationYearMonthDuration to a DateTimeWithZoneDateTimeWithZoneDateTimeWithZone.
Public operatorstaticAddition (DayTimeDuration, DateTimeWithZone)Addition (DayTimeDuration, DateTimeWithZone)Addition (DayTimeDuration, DateTimeWithZone) Adds a DayTimeDurationDayTimeDurationDayTimeDuration to a DateTimeWithZoneDateTimeWithZoneDateTimeWithZone.
Public operatorstaticAddition (YearMonthDuration, DateTimeWithZone)Addition (YearMonthDuration, DateTimeWithZone)Addition (YearMonthDuration, DateTimeWithZone) Adds a YearMonthDurationYearMonthDurationYearMonthDuration to a DateTimeWithZoneDateTimeWithZoneDateTimeWithZone
Public operatorstaticEqualityEqualityEquality Returns a value indicating whether two instances of DateTimeWithZoneDateTimeWithZoneDateTimeWithZone are equal.
Public operatorstaticInequalityInequalityInequality Returns a value indicating whether two instances of DateTimeWithZoneDateTimeWithZoneDateTimeWithZone are not equal.
Public operatorstaticSubtraction (DateTimeWithZone, DateTimeWithZone)Subtraction (DateTimeWithZone, DateTimeWithZone)Subtraction (DateTimeWithZone, DateTimeWithZone) Subtracts a DateTimeWithZoneDateTimeWithZoneDateTimeWithZone from another DateTimeWithZoneDateTimeWithZoneDateTimeWithZone.
Public operatorstaticSubtraction (DateTimeWithZone, DayTimeDuration)Subtraction (DateTimeWithZone, DayTimeDuration)Subtraction (DateTimeWithZone, DayTimeDuration) Subtracts a DayTimeDurationDayTimeDurationDayTimeDuration from a DateTimeWithZoneDateTimeWithZoneDateTimeWithZone.
Public operatorstaticSubtraction (DateTimeWithZone, YearMonthDuration)Subtraction (DateTimeWithZone, YearMonthDuration)Subtraction (DateTimeWithZone, YearMonthDuration) Subtracts a YearMonthDurationYearMonthDurationYearMonthDuration from a DateTimeWithZoneDateTimeWithZoneDateTimeWithZone.

Top

Remarks

Unlike DateTimeDateDateTime, a DateTimeWithZoneDateTimeWithZoneDateTimeWithZone may include a time zone.

Note that the order relation on DateTimeWithZoneDateTimeWithZoneDateTimeWithZone is a partial order.

The year 1 B.C. is represented as -1, not 0.