Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

struct NodaTime.​OffsetDate

Assembly: NodaTime

Implemented Interfaces

A combination of a <see cref="T:NodaTime.LocalDate" /> and an <see cref="P:NodaTime.OffsetDate.Offset" /> , to represent a date at a specific offset from UTC but without any time-of-day information.

Remarks

<para> Equality is defined in a component-wise fashion: two values are the same if they represent equal dates (including being in the same calendar) and equal offsets from UTC. Ordering between offset dates is not defined. </para> <para>The default value of this type is 0001-01-01 (January 1st, 1 C.E.) in the ISO calendar with a UTC offset of zero.</para>

Properties

public LocalDate
Date
Gets the local date represented by this value.
public Offset
Offset
Gets the offset from UTC of this value.
Calendar
Gets the calendar system associated with this offset date.
public int
Year
Gets the year of this offset date.
Remarks This returns the "absolute year", so, for the ISO calendar, a value of 0 means 1 BC, for example.
public int
Month
Gets the month of this offset date within the year.
public int
Day
Gets the day of this offset date within the month.
public IsoDayOfWeek
DayOfWeek
Gets the week day of this offset date expressed as an <see cref="T:NodaTime.IsoDayOfWeek" /> value.
public int
YearOfEra
Gets the year of this offset date within the era.
public Era
Era
Gets the era of this offset date.
public int
DayOfYear
Gets the day of this offset date within the year.

Methods

public OffsetDate
WithOffset​(Offset offset)
Creates a new <see cref="T:NodaTime.OffsetDate" /> for the same date, but with the specified UTC offset.
Returns A new <c>OffsetDate</c> for the same date, but with the specified UTC offset.
offset The new UTC offset.
public OffsetDate
With​(System.​Func<​LocalDate, LocalDate> adjuster)
Returns this offset date, with the given date adjuster applied to it, maintaining the existing offset.
Returns The adjusted offset date.
adjuster The adjuster to apply.
Remarks If the adjuster attempts to construct an invalid date (such as by trying to set a day-of-month of 30 in February), any exception thrown by that construction attempt will be propagated through this method.
public OffsetDate
WithCalendar​(CalendarSystem calendar)
Creates a new <see cref="T:NodaTime.OffsetDate" /> representing the same physical date and offset, but in a different calendar. The returned value 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.
Returns The converted <c>OffsetDate</c> .
calendar The calendar system to convert this offset date to.
At​(LocalTime time)
Combines this <see cref="T:NodaTime.OffsetDate" /> with the given <see cref="T:NodaTime.LocalTime" /> into an <see cref="T:NodaTime.OffsetDateTime" /> .
Returns The <see cref="T:NodaTime.OffsetDateTime" /> representation of the given time on this date.
time The time to combine with this date.
public int
GetHashCode​()
Returns a hash code for this offset date. See the type documentation for a description of equality semantics.
Returns A hash code for this offset date.
public bool
Equals​(object obj)
Compares two <see cref="T:NodaTime.OffsetDate" /> values for equality. See the type documentation for a description of equality semantics.
Returns True if the given value is another offset date equal to this one; false otherwise.
obj The object to compare this offset date with.
public bool
Equals​(OffsetDate other)
Compares two <see cref="T:NodaTime.OffsetDate" /> values for equality. See the type documentation for a description of equality semantics.
Returns True if the given value is another offset date equal to this one; false otherwise.
other The value to compare this offset date with.
public string
ToString​()
Returns a <see cref="T:System.String" /> that represents this instance.
Returns The value of the current instance in the default format pattern ("G"), using the current thread's culture to obtain a format provider.
public string
ToString​(string patternText, System.​IFormatProvider formatProvider)
Formats the value of the current instance using the specified pattern.
Returns A <see cref="T:System.String" /> containing the value of the current instance in the specified format.
patternText The <see cref="T:System.String" /> specifying the pattern to use, or null to use the default format pattern ("G").
formatProvider The <see cref="T:System.IFormatProvider" /> to use when formatting the value, or null to use the current thread's culture to obtain a format provider.
public void
Deconstruct​(LocalDate& localDate, Offset& offset)
AddSchema​(System.​Xml.​Schema.​XmlSchemaSet xmlSchemaSet)
Adds the XML schema type describing the structure of the <see cref="T:NodaTime.OffsetDate" /> XML serialization to the given <paramref name="xmlSchemaSet" /> .
Returns The qualified name of the schema type that was added to the <paramref name="xmlSchemaSet" /> .
xmlSchemaSet The XML schema set provided by <see cref="T:System.Xml.Serialization.XmlSchemaExporter" /> .
protected void
Finalize​()
Inherited from object
GetType​()
Inherited from object
protected object
MemberwiseClone​()
Inherited from object