CKTIS / C#
dates and time: praktická reference
dates and time: praktická reference: Čas rozlišuje okamžik, místní datum, zónu, posun a trvání.
Verze: C# language and .NET 10 reference runtime
Syntaxe
// timeČas rozlišuje okamžik, místní datum, zónu, posun a trvání.
Okamžiky ukládejte v UTC nebo DateTimeOffset a zónu držte jako samostatné obchodní pravidlo.
Nástěnné hodiny se mohou vrátit; pro intervaly použijte monotónní Stopwatch nebo TimeProvider.
DST vytváří neexistující a nejednoznačné časy a rozsahy typů jsou omezené.
Úplný program skutečně používá dates and time; přesně očekávaný stdout je 2026-11-18.
Pří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 date = new DateOnly(2026, 11, 17); Console.WriteLine(date.AddDays(1).ToString("yyyy-MM-dd", CultureInfo.InvariantCulture));
Výsledek
2026-11-18
Úplný program skutečně používá `dates and time`; přesně očekávaný stdout je `2026-11-18`.