CSharp examples for System:DateTimeOffset
Get Offset DateTime String
using System;/*from w ww . j a va 2s . co m*/ using Bridge.Test.NUnit; public class Main{ public static string GetOffsetString(int adjustment = 0) { var minutes = GetOffsetMinutes() + adjustment; var b = minutes < 0 ? "+" : "-"; minutes = Math.Abs(minutes); var offset = minutes != 0 ? (b + (minutes / 60).ToString("00") + ":" + (minutes % 60).ToString("00")) : "Z"; return offset; } }