METHOD

DateTimeOffset.ToOffset

Represents the same instant using another fixed offset. This is not a named time-zone conversion; offsets must be whole minutes within the supported range.

Formal Syntax & Structure

csharp syntaxcsharp
instant.ToOffset(offset)

Working Example

Example Snippetcsharp
using System;var instant = new DateTimeOffset(2026, 1, 1, 10, 0, 0, TimeSpan.Zero);Console.WriteLine(instant.ToOffset(TimeSpan.FromHours(2)).Hour); // 12
C# & .NET Reference