CSharp examples for System:DateTimeOffset
Create Date Time Offset
using System.Globalization; using System;// w w w.jav a2s.c o m public class Main{ public static DateTimeOffset CreateDateTimeOffset(DateTime dateTime, TimeZoneInfo imageSetTimeZone) { if (dateTime.Kind == DateTimeKind.Unspecified) { TimeSpan utcOffset = imageSetTimeZone.GetUtcOffset(dateTime); return new DateTimeOffset(dateTime, utcOffset); } return new DateTimeOffset(dateTime); } }