Convert DateTime object to local time in CSharp
Description
The following code shows how to convert DateTime object to local time.
Example
using System;// w ww . j a v a 2 s . c o m
public class Example
{
public static void Main()
{
DateTime date1 = new DateTime(2010, 3, 14, 2, 30, 0, DateTimeKind.Local);
DateTime date2 = date1.ToLocalTime();
Console.WriteLine("{0} --> {1}", date1, date2);
}
}
The code above generates the following result.