CKTIS / C#
System.TimeOnly: praktická referencia
System.TimeOnly: praktická referencia: TimeOnly predstavuje denný čas bez dátumu, časového pásma alebo posunu.
Verzia: .NET API; verified against .NET 10 reference surface
Syntax
System.TimeOnly /* select a documented member or constructor */TimeOnly predstavuje denný čas bez dátumu, časového pásma alebo posunu.
Použite na otváracie hodiny a opakované rozvrhy bez väzby na konkrétny dátum.
Nie je to okamih na časovej osi; konverzia vyžaduje dátum a časové pásmo.
Add sa môže obtočiť cez polnoc; rozsah pokrýva jeden deň.
Úplný program skutočne používa System.TimeOnly; presne očakávaný stdout je 14:30.
Príklady
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));
Výsledok
14:30
Úplný program skutočne používa `System.TimeOnly`; presne očakávaný stdout je `14:30`.