Struct OffsetDateTime
Implements
Inherited Members
Namespace: NodaTime
Assembly: NodaTime.dll
Syntax
public struct OffsetDateTime : IEquatable<OffsetDateTime>
Remarks
A value of this type unambiguously represents both a local time and an instant on the timeline, but does not have a well-defined time zone. This means you cannot reliably know what the local time would be five minutes later, for example. While this doesn't sound terribly useful, it's very common in text representations.
Currently there is no real text handling support for this type.
Constructors
OffsetDateTime(LocalDateTime, Offset)
Declaration
public OffsetDateTime(LocalDateTime localDateTime, Offset offset)
Parameters
Type | Name | Description |
---|---|---|
LocalDateTime | localDateTime | Local date and time to represent |
Offset | offset | Offset from UTC |
Remarks
A value of this type unambiguously represents both a local time and an instant on the timeline, but does not have a well-defined time zone. This means you cannot reliably know what the local time would be five minutes later, for example. While this doesn't sound terribly useful, it's very common in text representations.
Currently there is no real text handling support for this type.
Properties
Calendar
Declaration
public CalendarSystem Calendar { get; }
Property Value
Type | Description |
---|---|
CalendarSystem |
Remarks
A value of this type unambiguously represents both a local time and an instant on the timeline, but does not have a well-defined time zone. This means you cannot reliably know what the local time would be five minutes later, for example. While this doesn't sound terribly useful, it's very common in text representations.
Currently there is no real text handling support for this type.
ClockHourOfHalfDay
Declaration
public int ClockHourOfHalfDay { get; }
Property Value
Type | Description |
---|---|
Int32 |
Remarks
A value of this type unambiguously represents both a local time and an instant on the timeline, but does not have a well-defined time zone. This means you cannot reliably know what the local time would be five minutes later, for example. While this doesn't sound terribly useful, it's very common in text representations.
Currently there is no real text handling support for this type.
Date
Declaration
public LocalDate Date { get; }
Property Value
Type | Description |
---|---|
LocalDate |
Remarks
A value of this type unambiguously represents both a local time and an instant on the timeline, but does not have a well-defined time zone. This means you cannot reliably know what the local time would be five minutes later, for example. While this doesn't sound terribly useful, it's very common in text representations.
Currently there is no real text handling support for this type.
Day
Declaration
public int Day { get; }
Property Value
Type | Description |
---|---|
Int32 |
Remarks
A value of this type unambiguously represents both a local time and an instant on the timeline, but does not have a well-defined time zone. This means you cannot reliably know what the local time would be five minutes later, for example. While this doesn't sound terribly useful, it's very common in text representations.
Currently there is no real text handling support for this type.
DayOfWeek
Declaration
public int DayOfWeek { get; }
Property Value
Type | Description |
---|---|
Int32 |
Remarks
See Also
DayOfYear
Declaration
public int DayOfYear { get; }
Property Value
Type | Description |
---|---|
Int32 |
Remarks
A value of this type unambiguously represents both a local time and an instant on the timeline, but does not have a well-defined time zone. This means you cannot reliably know what the local time would be five minutes later, for example. While this doesn't sound terribly useful, it's very common in text representations.
Currently there is no real text handling support for this type.
Era
Declaration
public Era Era { get; }
Property Value
Type | Description |
---|---|
Era |
Remarks
A value of this type unambiguously represents both a local time and an instant on the timeline, but does not have a well-defined time zone. This means you cannot reliably know what the local time would be five minutes later, for example. While this doesn't sound terribly useful, it's very common in text representations.
Currently there is no real text handling support for this type.
Hour
Declaration
public int Hour { get; }
Property Value
Type | Description |
---|---|
Int32 |
Remarks
A value of this type unambiguously represents both a local time and an instant on the timeline, but does not have a well-defined time zone. This means you cannot reliably know what the local time would be five minutes later, for example. While this doesn't sound terribly useful, it's very common in text representations.
Currently there is no real text handling support for this type.
IsoDayOfWeek
Declaration
public IsoDayOfWeek IsoDayOfWeek { get; }
Property Value
Type | Description |
---|---|
IsoDayOfWeek |
Remarks
A value of this type unambiguously represents both a local time and an instant on the timeline, but does not have a well-defined time zone. This means you cannot reliably know what the local time would be five minutes later, for example. While this doesn't sound terribly useful, it's very common in text representations.
Currently there is no real text handling support for this type.
Exceptions
Type | Condition |
---|---|
InvalidOperationException | The underlying calendar doesn't use ISO days of the week. |
See Also
LocalDateTime
Declaration
public LocalDateTime LocalDateTime { get; }
Property Value
Type | Description |
---|---|
LocalDateTime |
Remarks
A value of this type unambiguously represents both a local time and an instant on the timeline, but does not have a well-defined time zone. This means you cannot reliably know what the local time would be five minutes later, for example. While this doesn't sound terribly useful, it's very common in text representations.
Currently there is no real text handling support for this type.
Millisecond
Declaration
public int Millisecond { get; }
Property Value
Type | Description |
---|---|
Int32 |
Remarks
A value of this type unambiguously represents both a local time and an instant on the timeline, but does not have a well-defined time zone. This means you cannot reliably know what the local time would be five minutes later, for example. While this doesn't sound terribly useful, it's very common in text representations.
Currently there is no real text handling support for this type.
Minute
Declaration
public int Minute { get; }
Property Value
Type | Description |
---|---|
Int32 |
Remarks
A value of this type unambiguously represents both a local time and an instant on the timeline, but does not have a well-defined time zone. This means you cannot reliably know what the local time would be five minutes later, for example. While this doesn't sound terribly useful, it's very common in text representations.
Currently there is no real text handling support for this type.
Month
Declaration
public int Month { get; }
Property Value
Type | Description |
---|---|
Int32 |
Remarks
A value of this type unambiguously represents both a local time and an instant on the timeline, but does not have a well-defined time zone. This means you cannot reliably know what the local time would be five minutes later, for example. While this doesn't sound terribly useful, it's very common in text representations.
Currently there is no real text handling support for this type.
Offset
Declaration
public Offset Offset { get; }
Property Value
Type | Description |
---|---|
Offset |
Remarks
A value of this type unambiguously represents both a local time and an instant on the timeline, but does not have a well-defined time zone. This means you cannot reliably know what the local time would be five minutes later, for example. While this doesn't sound terribly useful, it's very common in text representations.
Currently there is no real text handling support for this type.
Second
Declaration
public int Second { get; }
Property Value
Type | Description |
---|---|
Int32 |
Remarks
A value of this type unambiguously represents both a local time and an instant on the timeline, but does not have a well-defined time zone. This means you cannot reliably know what the local time would be five minutes later, for example. While this doesn't sound terribly useful, it's very common in text representations.
Currently there is no real text handling support for this type.
TickOfDay
Declaration
public long TickOfDay { get; }
Property Value
Type | Description |
---|---|
Int64 |
Remarks
A value of this type unambiguously represents both a local time and an instant on the timeline, but does not have a well-defined time zone. This means you cannot reliably know what the local time would be five minutes later, for example. While this doesn't sound terribly useful, it's very common in text representations.
Currently there is no real text handling support for this type.
TickOfSecond
Declaration
public int TickOfSecond { get; }
Property Value
Type | Description |
---|---|
Int32 |
Remarks
A value of this type unambiguously represents both a local time and an instant on the timeline, but does not have a well-defined time zone. This means you cannot reliably know what the local time would be five minutes later, for example. While this doesn't sound terribly useful, it's very common in text representations.
Currently there is no real text handling support for this type.
TimeOfDay
Declaration
public LocalTime TimeOfDay { get; }
Property Value
Type | Description |
---|---|
LocalTime |
Remarks
A value of this type unambiguously represents both a local time and an instant on the timeline, but does not have a well-defined time zone. This means you cannot reliably know what the local time would be five minutes later, for example. While this doesn't sound terribly useful, it's very common in text representations.
Currently there is no real text handling support for this type.
WeekOfWeekYear
Declaration
public int WeekOfWeekYear { get; }
Property Value
Type | Description |
---|---|
Int32 |
Remarks
A value of this type unambiguously represents both a local time and an instant on the timeline, but does not have a well-defined time zone. This means you cannot reliably know what the local time would be five minutes later, for example. While this doesn't sound terribly useful, it's very common in text representations.
Currently there is no real text handling support for this type.
WeekYear
Declaration
public int WeekYear { get; }
Property Value
Type | Description |
---|---|
Int32 |
Remarks
The WeekYear is the year that matches with the WeekOfWeekYear field. In the standard ISO8601 week algorithm, the first week of the year is that in which at least 4 days are in the year. As a result of this definition, day 1 of the first week may be in the previous year. The WeekYear allows you to query the effective year for that day.
For example, January 1st 2011 was a Saturday, so only two days of that week (Saturday and Sunday) were in 2011. Therefore January 1st is part of week 52 of WeekYear 2010. Conversely, December 31st 2012 is a Monday, so is part of week 1 of WeekYear 2013.
Year
Declaration
public int Year { get; }
Property Value
Type | Description |
---|---|
Int32 |
Remarks
YearOfCentury
Declaration
public int YearOfCentury { get; }
Property Value
Type | Description |
---|---|
Int32 |
Remarks
YearOfEra
Declaration
public int YearOfEra { get; }
Property Value
Type | Description |
---|---|
Int32 |
Remarks
A value of this type unambiguously represents both a local time and an instant on the timeline, but does not have a well-defined time zone. This means you cannot reliably know what the local time would be five minutes later, for example. While this doesn't sound terribly useful, it's very common in text representations.
Currently there is no real text handling support for this type.
Methods
Equals(OffsetDateTime)
Declaration
public bool Equals(OffsetDateTime other)
Parameters
Type | Name | Description |
---|---|---|
OffsetDateTime | other | The value to compare this offset date/time with. |
Returns
Type | Description |
---|---|
Boolean | True if the given value is another offset date/time equal to this one; false otherwise. |
Remarks
A value of this type unambiguously represents both a local time and an instant on the timeline, but does not have a well-defined time zone. This means you cannot reliably know what the local time would be five minutes later, for example. While this doesn't sound terribly useful, it's very common in text representations.
Currently there is no real text handling support for this type.
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | The object to compare this date with. |
Returns
Type | Description |
---|---|
Boolean | True if the given value is another offset date/time equal to this one; false otherwise. |
Overrides
Remarks
A value of this type unambiguously represents both a local time and an instant on the timeline, but does not have a well-defined time zone. This means you cannot reliably know what the local time would be five minutes later, for example. While this doesn't sound terribly useful, it's very common in text representations.
Currently there is no real text handling support for this type.
FromDateTimeOffset(DateTimeOffset)
Declaration
public static OffsetDateTime FromDateTimeOffset(DateTimeOffset dateTimeOffset)
Parameters
Type | Name | Description |
---|---|---|
DateTimeOffset | dateTimeOffset | DateTimeOffset to convert |
Returns
Type | Description |
---|---|
OffsetDateTime | The converted offset date and time |
Remarks
A value of this type unambiguously represents both a local time and an instant on the timeline, but does not have a well-defined time zone. This means you cannot reliably know what the local time would be five minutes later, for example. While this doesn't sound terribly useful, it's very common in text representations.
Currently there is no real text handling support for this type.
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 | A hash code for this local date. |
Overrides
Remarks
A value of this type unambiguously represents both a local time and an instant on the timeline, but does not have a well-defined time zone. This means you cannot reliably know what the local time would be five minutes later, for example. While this doesn't sound terribly useful, it's very common in text representations.
Currently there is no real text handling support for this type.
InFixedZone()
Declaration
public ZonedDateTime InFixedZone()
Returns
Type | Description |
---|---|
ZonedDateTime | A zoned date/time with the same local time and a fixed time zone using the offset from this value. |
Remarks
This method returns a ZonedDateTime with the same local date and time as this value, using a fixed time zone with the same offset as the offset for this value.
Note that because the resulting ZonedDateTime
has a fixed time zone, it is generally not useful to
use this result for arithmetic operations, as the zone will not adjust to account for daylight savings.
ToDateTimeOffset()
Declaration
public DateTimeOffset ToDateTimeOffset()
Returns
Type | Description |
---|---|
DateTimeOffset | A DateTimeOffset with the same local date/time and offset as this. The DateTime part of the result always has a "kind" of Unspecified. |
Remarks
A value of this type unambiguously represents both a local time and an instant on the timeline, but does not have a well-defined time zone. This means you cannot reliably know what the local time would be five minutes later, for example. While this doesn't sound terribly useful, it's very common in text representations.
Currently there is no real text handling support for this type.
ToInstant()
Declaration
public Instant ToInstant()
Returns
Type | Description |
---|---|
Instant | The instant represented by this offset date and time |
Remarks
A value of this type unambiguously represents both a local time and an instant on the timeline, but does not have a well-defined time zone. This means you cannot reliably know what the local time would be five minutes later, for example. While this doesn't sound terribly useful, it's very common in text representations.
Currently there is no real text handling support for this type.
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String | A string representation of this value. |
Overrides
Remarks
An offset of 0 is represented by "Z", otherwise the offset is the number of hours and optionally minutes, e.g. "01" or "01:30".
This representation is a temporary measure until full support for parsing and formatting OffsetDateTime values is implemented. It is provided in order to make diagnostics simpler, but is likely to be changed in future releases.
Operators
Equality(OffsetDateTime, OffsetDateTime)
Declaration
public static bool operator ==(OffsetDateTime left, OffsetDateTime right)
Parameters
Type | Name | Description |
---|---|---|
OffsetDateTime | left | The left hand side of the operator. |
OffsetDateTime | right | The right hand side of the operator. |
Returns
Type | Description |
---|---|
Boolean | true if values are equal to each other, otherwise false . |
Remarks
A value of this type unambiguously represents both a local time and an instant on the timeline, but does not have a well-defined time zone. This means you cannot reliably know what the local time would be five minutes later, for example. While this doesn't sound terribly useful, it's very common in text representations.
Currently there is no real text handling support for this type.
Inequality(OffsetDateTime, OffsetDateTime)
Declaration
public static bool operator !=(OffsetDateTime left, OffsetDateTime right)
Parameters
Type | Name | Description |
---|---|---|
OffsetDateTime | left | The left hand side of the operator. |
OffsetDateTime | right | The right hand side of the operator. |
Returns
Type | Description |
---|---|
Boolean | true if values are not equal to each other, otherwise false . |
Remarks
A value of this type unambiguously represents both a local time and an instant on the timeline, but does not have a well-defined time zone. This means you cannot reliably know what the local time would be five minutes later, for example. While this doesn't sound terribly useful, it's very common in text representations.
Currently there is no real text handling support for this type.