CKTIS / C#
System.DateTime: praktická reference
System.DateTime: praktická reference: DateTime spojuje datum a čas s Kind Utc, Local nebo Unspecified.
Verze: .NET API; verified on .NET 10.0.14
Syntaxe
System.DateTime /* select a documented member or constructor */DateTime spojuje datum a čas s Kind Utc, Local nebo Unspecified.
Používejte jej s explicitním Kind; pro události mezi systémy je často bezpečnější DateTimeOffset.
Kind neuchovává libovolné časové pásmo a pravidla letního času vytvářejí neplatné či nejednoznačné místní časy.
Rozsah je omezený a místní převody závisí na nastavení časového pásma systému.
Úplný program skutečně používá System.DateTime; přesně očekávaný stdout je 2026-11-17T12:00:00.0000000Z.
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 instant = new DateTime(2026, 11, 17, 12, 0, 0, DateTimeKind.Utc);
Console.WriteLine(instant.ToString("O", CultureInfo.InvariantCulture));
Výsledek
2026-11-17T12:00:00.0000000Z
Úplný program skutečně používá `System.DateTime`; přesně očekávaný stdout je `2026-11-17T12:00:00.0000000Z`.