CSharp examples for System:DateTime UTC
Switch To Utc Time
// Permission is hereby granted, free of charge, to any person using System.Globalization; using System.Xml; using System.IO;//from w w w . ja v a 2 s .c o m using System; public class Main{ private static DateTime SwitchToUtcTime(DateTime value) { switch (value.Kind) { case DateTimeKind.Unspecified: return new DateTime(value.Ticks, DateTimeKind.Utc); case DateTimeKind.Utc: return value; case DateTimeKind.Local: return value.ToUniversalTime(); } return value; } }