7public readonly
struct DateOnly :
IComparable,
IComparable<DateOnly>,
IEquatable<DateOnly>,
ISpanFormattable,
IFormattable,
IComparisonOperators<DateOnly, DateOnly>,
IEqualityOperators<DateOnly, DateOnly>,
IMinMaxValue<DateOnly>,
ISpanParseable<DateOnly>,
IParseable<DateOnly>
27 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
30 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
35 return (
int)(dt.Ticks / 864000000000
L);
60 if ((uint)dayNumber > 3652058u)
70 if ((uint)num > 3652058u)
75 static void ThrowOutOfRange()
177 if (parseFailureKind != 0)
188 if (parseFailureKind != 0)
204 if (parseFailureKind != 0)
222 return Parse(
s.AsSpan(), provider, style);
269 if (((uint)style & 0xFFFFFFF8u) != 0)
302 if (((uint)style & 0xFFFFFFF8u) != 0)
313 format =
"yyyy'-'MM'-'dd";
318 format =
"ddd, dd MMM yyyy";
351 if (((uint)style & 0xFFFFFFF8u) != 0 ||
formats ==
null)
357 for (
int i = 0; i <
formats.Length; i++)
361 if (
string.IsNullOrEmpty(
text))
366 if (
text.Length == 1)
372 text =
"yyyy'-'MM'-'dd";
377 text =
"ddd, dd MMM yyyy";
406 return TryParse(
s.AsSpan(), provider, style, out result);
416 if (
s ==
null ||
format ==
null)
564 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
570 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
573 return left <= right;
576 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
582 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
585 return left >= right;
588 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
591 return left == right;
594 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
597 return left != right;
600 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
603 return Parse(
s, provider);
606 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
612 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
615 return Parse(
s, provider);
618 [RequiresPreviewFeatures(
"Generic Math is in preview.", Url =
"https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool TryParse(ReadOnlySpan< char > s, DateTimeFormatInfo dtfi, DateTimeStyles styles, out DateTime result)
static bool TryParseExact(ReadOnlySpan< char > s, ReadOnlySpan< char > format, DateTimeFormatInfo dtfi, DateTimeStyles style, out DateTime result)
static CultureInfo InvariantCulture
static string ArgumentOutOfRange_AddValue
static string Format(string resourceFormat, object p1)
static string Argument_InvalidDateStyles
static string Argument_BadFormatSpecifier
static string Arg_MustBeDateOnly
static string Format_DateTimeOnlyContainsNoneDateParts
static string Format_InvalidString
static string Format_BadDateOnly
static void ThrowArgumentNullException(string name)
static void ThrowArgumentOutOfRange_DayNumber(int dayNumber)
static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out TSelf result)
static TSelf Parse(string s, IFormatProvider? provider)
static bool TryParse(ReadOnlySpan< char > s, IFormatProvider? provider, out TSelf result)
static TSelf Parse(ReadOnlySpan< char > s, IFormatProvider? provider)
static bool operator<=(DateOnly left, DateOnly right)
string ToString(string? format)
static DateOnly ParseExact(ReadOnlySpan< char > s, string[] formats, IFormatProvider? provider, DateTimeStyles style=DateTimeStyles.None)
override bool Equals([NotNullWhen(true)] object? value)
static bool TryParseExact(ReadOnlySpan< char > s, ReadOnlySpan< char > format, out DateOnly result)
static bool TryParseExact(ReadOnlySpan< char > s, ReadOnlySpan< char > format, IFormatProvider? provider, DateTimeStyles style, out DateOnly result)
static ParseFailureKind TryParseExactInternal(ReadOnlySpan< char > s, string[] formats, IFormatProvider provider, DateTimeStyles style, out DateOnly result)
static void ThrowOnError(ParseFailureKind result, ReadOnlySpan< char > s)
static ParseFailureKind TryParseInternal(ReadOnlySpan< char > s, IFormatProvider provider, DateTimeStyles style, out DateOnly result)
static DateOnly FromDayNumber(int dayNumber)
static bool TryParseExact(ReadOnlySpan< char > s, [NotNullWhen(true)] string?[]? formats, IFormatProvider? provider, DateTimeStyles style, out DateOnly result)
static DateOnly ParseExact(string s, string format)
static DateOnly Parse(ReadOnlySpan< char > s, IFormatProvider? provider=null, DateTimeStyles style=DateTimeStyles.None)
DateTime GetEquivalentDateTime()
static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, DateTimeStyles style, out DateOnly result)
static DateOnly ParseExact(ReadOnlySpan< char > s, string[] formats)
static bool operator==(DateOnly left, DateOnly right)
DateOnly AddMonths(int value)
static DateOnly IMinMaxValue< DateOnly >. MaxValue
static bool TryParseExact([NotNullWhen(true)] string? s, [NotNullWhen(true)] string? format, out DateOnly result)
static DateOnly IMinMaxValue< DateOnly >. MinValue
static int DayNumberFromDateTime(DateTime dt)
DateOnly AddYears(int value)
static ParseFailureKind TryParseExactInternal(ReadOnlySpan< char > s, ReadOnlySpan< char > format, IFormatProvider provider, DateTimeStyles style, out DateOnly result)
bool TryFormat(Span< char > destination, out int charsWritten, ReadOnlySpan< char > format=default(ReadOnlySpan< char >), IFormatProvider? provider=null)
static bool TryParseExact([NotNullWhen(true)] string? s, [NotNullWhen(true)] string? format, IFormatProvider? provider, DateTimeStyles style, out DateOnly result)
static DateOnly ParseExact(string s, string[] formats, IFormatProvider? provider, DateTimeStyles style=DateTimeStyles.None)
override int GetHashCode()
string ToShortDateString()
static DateOnly ParseExact(string s, string[] formats)
static bool TryParse(ReadOnlySpan< char > s, out DateOnly result)
string ToLongDateString()
DateOnly(int year, int month, int day, Calendar calendar)
DateTime ToDateTime(TimeOnly time)
static DateOnly FromDateTime(DateTime dateTime)
static bool TryParseExact([NotNullWhen(true)] string? s, [NotNullWhen(true)] string?[]? formats, out DateOnly result)
static bool TryParseExact(ReadOnlySpan< char > s, [NotNullWhen(true)] string?[]? formats, out DateOnly result)
DateOnly(int year, int month, int day)
static DateOnly Parse(string s, IFormatProvider? provider, DateTimeStyles style=DateTimeStyles.None)
bool Equals(DateOnly value)
DateOnly AddDays(int value)
static DateOnly ParseExact(ReadOnlySpan< char > s, ReadOnlySpan< char > format, IFormatProvider? provider=null, DateTimeStyles style=DateTimeStyles.None)
string ToString(IFormatProvider? provider)
int CompareTo(DateOnly value)
static bool operator>=(DateOnly left, DateOnly right)
static bool TryParse([NotNullWhen(true)] string? s, out DateOnly result)
override string ToString()
static bool operator>(DateOnly left, DateOnly right)
DateTime ToDateTime(TimeOnly time, DateTimeKind kind)
static bool operator!=(DateOnly left, DateOnly right)
static bool TryParse(ReadOnlySpan< char > s, IFormatProvider? provider, DateTimeStyles style, out DateOnly result)
static bool TryParseExact([NotNullWhen(true)] string? s, [NotNullWhen(true)] string?[]? formats, IFormatProvider? provider, DateTimeStyles style, out DateOnly result)
static DateOnly ParseExact(string s, string format, IFormatProvider? provider, DateTimeStyles style=DateTimeStyles.None)
int CompareTo(object? value)
static DateOnly Parse(string s)
static bool operator<(DateOnly left, DateOnly right)
string ToString(string? format, IFormatProvider? provider)
void Init(ReadOnlySpan< char > originalDateTimeString)
static DateTime UnsafeCreate(long ticks)