Noda Time
OffsetDateTime Structure
NamespacesNodaTimeOffsetDateTime

[This is preliminary documentation and is subject to change.]

A local date and time in a particular calendar system, combined with an offset from UTC. This is broadly similar to DateTimeOffset in the BCL.
Declaration Syntax
C#Visual BasicVisual C++
public struct OffsetDateTime : IEquatable<OffsetDateTime>, 
	IXmlSerializable
Public Structure OffsetDateTime _
	Implements IEquatable(Of OffsetDateTime), IXmlSerializable
public value class OffsetDateTime : IEquatable<OffsetDateTime>, 
	IXmlSerializable
Members
All MembersConstructorsMethodsProperties



IconMemberDescription
OffsetDateTime(LocalDateTime, Offset)
Constructs a new offset date/time with the given local date and time, and the given offset from UTC.

Calendar
Gets the calendar system associated with this local date and time.

ClockHourOfHalfDay
Gets the hour of the half-day of this date and time, in the range 1 to 12 inclusive.

Date
Gets the local date represented by this offset date and time. The returned LocalDate will have the same calendar system and return the same values for each of the date-based calendar properties (Year, MonthOfYear and so on), but will not have any offset information.

Day
Gets the day of this offset date and time within the month.

DayOfWeek
Gets the week day of this offset date and time as a number.

DayOfYear
Gets the day of this offset date and time within the year.

Equality(OffsetDateTime, OffsetDateTime)
Implements the operator == (equality).

Equals(Object)
Compares two OffsetDateTime values for equality. This requires that the local date/time values be the same (in the same calendar) and the offsets.
(Overrides ValueType.Equals(Object).)
Equals(OffsetDateTime)
Compares two OffsetDateTime values for equality. This requires that the local date/time values be the same (in the same calendar) and the offsets.

Era
Gets the era of this offset date and time.

FromDateTimeOffset(DateTimeOffset)
Builds an OffsetDateTime from a BCL DateTimeOffset by converting the DateTime part to a LocalDateTime, and the offset part to an Offset.

GetHashCode()()()()
Returns a hash code for this local date.
(Overrides ValueType.GetHashCode()()()().)
Hour
Gets the hour of day of this offset date and time, in the range 0 to 23 inclusive.

Inequality(OffsetDateTime, OffsetDateTime)
Implements the operator != (inequality).

InFixedZone()()()()
Returns this value as a ZonedDateTime.

IsoDayOfWeek
Gets the week day of this offset date and time expressed as an IsoDayOfWeek value, for calendars which use ISO days of the week.

LocalDateTime
Returns the local date and time represented within this offset date and time.

Millisecond
Gets the millisecond of this offset date and time within the second, in the range 0 to 999 inclusive.

Minute
Gets the minute of this offset date and time, in the range 0 to 59 inclusive.

Month
Gets the month of this offset date and time within the year.

Offset
Returns the offset from UTC.

Second
Gets the second of this offset date and time within the minute, in the range 0 to 59 inclusive.

TickOfDay
Gets the tick of this offset date and time within the day, in the range 0 to 863,999,999,999 inclusive.

TickOfSecond
Gets the tick of this offset date and time within the second, in the range 0 to 9,999,999 inclusive.

TimeOfDay
Gets the time portion of this offset date and time. The returned LocalTime will return the same values for each of the time-based properties (Hour, Minute and so on), but will not have any offset information.

ToDateTimeOffset()()()()
Returns the BCL DateTimeOffset corresponding to this offset date and time.

ToInstant()()()()
Converts this offset date and time to an instant in time by subtracting the offset from the local date and time.

ToString()()()()
Currently returns a string representation of this value according to ISO-8601, extended where necessary to include fractional seconds, and using a colon within the offset where hour/minute or minute/second separators are required.
(Overrides ValueType.ToString()()()().)
WeekOfWeekYear
Gets the week within the WeekYear. See WeekYear for more details.

WeekYear
Gets the "week year" of this offset date and time.

WithCalendar(CalendarSystem)
Creates a new OffsetDateTime representing the same physical date, time and offset, but in a different calendar. The returned OffsetDateTime is likely to have different date field values to this one. For example, January 1st 1970 in the Gregorian calendar was December 19th 1969 in the Julian calendar.

Year
Gets the year of this offset date and time.

YearOfCentury
Gets the year of this offset date and time within the century.

YearOfEra
Gets the year of this offset date and time within the 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.

Thread Safety
This type is an immutable value type. See the thread safety section of the user guide for more information.

Assembly: NodaTime (Module: NodaTime.dll) Version: 1.2.0.0 (1.2.0)