Show / Hide Table of Contents

Struct DateOnly

Represents a calendar date within the range 0001-01-01 to 9999-12-31, with no time component.

Implements
System.IComparable
System.IComparable<DateOnly>
System.IEquatable<DateOnly>
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetType()
Namespace: Esri.ArcGISRuntime
Assembly: Esri.ArcGISRuntime.dll
Syntax
public readonly struct DateOnly : IComparable, IComparable<DateOnly>, IEquatable<DateOnly>
Remarks

This type is a compatibility shim for System.DateOnly for projects targeting .NET Framework and UWP. For projects targeting .NET 8.0 or newer, use the system type instead.

Constructors

Name Description
DateOnly(Int32, Int32, Int32)

Initializes a new instance of the DateOnly struct with the specified year, month, and day.

Properties

Name Description
Day

Gets the day component of the date.

MaxValue

Gets the largest possible value of DateOnly (9999-12-31).

MinValue

Gets the smallest possible value of DateOnly (0001-01-01).

Month

Gets the month component of the date.

Year

Gets the year component of the date.

Methods

Name Description
CompareTo(DateOnly)
CompareTo(Object)
Equals(DateOnly)
Equals(Object)
FromDateTime(DateTime)

Converts System.DateTime to DateOnly. Only year, month, and day are used and any time-related information is lost in the conversion.

GetHashCode()
Parse(String)

Creates a new DateOnly struct that represents the given ISO 8601 date string (YYYY-MM-DD).

ToDateTime(TimeOnly)

Converts this DateOnly to a System.DateTime with a specified time.

ToString()

Operators

Name Description
Equality(DateOnly, DateOnly)

Checks if two DateOnly instances are equal.

GreaterThan(DateOnly, DateOnly)

Checks if left DateOnly instance is greater than the right one.

GreaterThanOrEqual(DateOnly, DateOnly)

Checks if left DateOnly instance is greater than or equal to the right one.

Inequality(DateOnly, DateOnly)

Checks if two DateOnly instances are not equal.

LessThan(DateOnly, DateOnly)

Checks if left DateOnly instance is less than the right one.

LessThanOrEqual(DateOnly, DateOnly)

Checks if left DateOnly instance is less than or equal to the right one.

Applies to

TargetVersions
.NET Framework200.4 - 200.7
UWP200.4 - 200.7
In This Article
Back to top Copyright © 2022 Esri.