CKTIS / C#
System.DateOnly: practical reference
System.DateOnly: practical reference: DateOnly represents a calendar date without a time of day or time zone.
Version: .NET API; verified on .NET 10.0.14
Syntax
System.DateOnly /* select a documented member or constructor */DateOnly represents a calendar date without a time of day or time zone.
Use it for birthdays, due dates, and business days that are not instants on a global timeline.
Parsing and formatting depend on culture, and creating an instant also requires a TimeOnly value and a time zone.
The supported range is 0001-01-01 through 9999-12-31; operations beyond it throw.
The complete program actually uses System.DateOnly; its exact expected stdout is 2026-11-17.
Examples
using System;
using System.Buffers;
using System.Collections.Concurrent;
using System.Collections.Frozen;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Text.Json.Serialization;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Channels;
using System.Threading.Tasks;
using Number = System.Int32;
var date = new DateOnly(2026, 11, 17);
Console.WriteLine(date.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture));
Result
2026-11-17
The complete program actually uses `System.DateOnly`; its exact expected stdout is `2026-11-17`.