CKTIS / C#
System.DateTimeOffset: practical reference
System.DateTimeOffset: practical reference: DateTimeOffset combines a clock reading with an offset and therefore identifies one unambiguous instant.
Version: .NET API; verified on .NET 10.0.14
Syntax
System.DateTimeOffset /* select a documented member or constructor */DateTimeOffset combines a clock reading with an offset and therefore identifies one unambiguous instant.
Use it for timestamps exchanged between systems while preserving the observed offset.
An offset is not a time-zone identifier and does not retain that zone’s historical daylight-saving rules.
The offset must be within plus or minus fourteen hours in whole minutes, and the resulting UTC instant must be in range.
The complete program actually uses System.DateTimeOffset; its exact expected stdout is +01:00.
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 instant = new DateTimeOffset(2026, 11, 17, 12, 0, 0, TimeSpan.FromHours(1));
Console.WriteLine(instant.ToString("zzz", CultureInfo.InvariantCulture));
Result
+01:00
The complete program actually uses `System.DateTimeOffset`; its exact expected stdout is `+01:00`.