CKTIS / C#
System.TimeOnly: practical reference
System.TimeOnly: practical reference: TimeOnly represents a time of day without a date, time zone, or offset.
Version: .NET API; verified against .NET 10 reference surface
Syntax
System.TimeOnly /* select a documented member or constructor */TimeOnly represents a time of day without a date, time zone, or offset.
Use it for opening hours and recurring schedules unrelated to a specific date.
It is not an instant on the timeline; conversion requires a date and time zone.
Add can wrap across midnight; the range covers one day.
The complete program actually uses System.TimeOnly; its exact expected stdout is 14:30.
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 time = new TimeOnly(14, 30);
Console.WriteLine(time.ToString("HH:mm", CultureInfo.InvariantCulture));
Result
14:30
The complete program actually uses `System.TimeOnly`; its exact expected stdout is `14:30`.