CSharp examples for System:DateTime Local
Switch DateTime To Local 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 va 2s .c o m*/ using System; public class Main{ private static DateTime SwitchToLocalTime(DateTime value) { switch (value.Kind) { case DateTimeKind.Unspecified: return new DateTime(value.Ticks, DateTimeKind.Local); case DateTimeKind.Utc: return value.ToLocalTime(); case DateTimeKind.Local: return value; } return value; } }