Development · Native API migration preview · Coverage validation in progress Published release →

API Browser

Struct

Date

struct Date

Module: System.Time
Assembly: System.Runtime.dll
Source file: Date.rvn

Inheritance: Object → ValueType → Date
Implements: ComparableTo<Date>, EquatableTo<Date>, Formattable

A Gregorian calendar date from year 1 through 9999, without a time or time zone.

Remarks

DayNumber 0 is 0001-01-01; the last supported day number is 3652058. Create and FromDayNumber return InvalidDateError outside the supported Gregorian range.

Properties

5 items
Day: int Gets the day within the month, starting at 1.
DayNumber: int Gets the zero-based number of days since 0001-01-01.
DayOfYear: int Gets the day within the year, starting at 1.
Month: int Gets the month from 1 through 12.
Year: int Gets the Gregorian year from 1 through 9999.

Methods

16 items
AddDays(days: int) -> Result<Date, InvalidDateError> Adds calendar days, returning an error outside years 1–9999.
AddMonths(months: int) -> Result<Date, InvalidDateError> Adds months and clamps the day to the last day of the target month.
AddYears(years: int) -> Result<Date, InvalidDateError> Adds years, clamping February 29 to February 28 when necessary.
CompareTo(other: Date) -> int Compares this value with the other value; returns a negative integer, zero or a positive integer for less than, equal to or greater than. Implements ComparableTo<Date>.CompareTo
Static member: Create(year: int, month: int, day: int) -> Result<Date, InvalidDateError> Validates the supplied date components and returns the value or its typed validation error.
Equals(other: Date) -> bool Tests value equality with the other value. Implements EquatableTo<Date>.Equals
Equals(other: object?) -> bool Compares the complete value with a boxed Date; null and other types are unequal. Overrides Object.Equals
Static member: FromDayNumber(dayNumber: int) -> Result<Date, InvalidDateError> Creates a date from the zero-based day number, or returns InvalidDateError outside 0–3652058.
GetHashCode() -> int Returns an execution-local value hash consistent with equality; not a persistent identifier. Overrides Object.GetHashCode
GetType() -> TypeInfo Returns metadata for the concrete runtime type of this instance. Inherited from Object.GetType
Static member: Parse(value: string, culture: Culture) -> Result<Date, DateTimeParseError> Parses a supported numeric Gregorian value with an explicit culture.
Static member: Parse(value: string) -> Result<Date, DateTimeParseError> Parses a supported numeric civil value using Culture.Current.
ToString(culture: Culture) -> string Formats with a culture's Gregorian default; no ambient culture is read.
ToString(format: string, culture: Culture) -> string Formats with an explicit culture; unsupported specifiers fault. O/o is invariant. Implements Formattable.ToString
ToString(format: string) -> string Formats with Culture.Current; supported formats are documented by DateTimeFormat.FormatDate.
ToString() -> string Formats using Culture.Current; pass Culture.Invariant for deterministic output. Overrides Object.ToString