Subtracts a time interval from DateTimeOffset
using System;
using System.Globalization;
public class Test
{
public static void Main()
{
DateTimeOffset originalTime, localTime;
originalTime = new DateTimeOffset(2007, 3, 11, 3, 0, 0, new TimeSpan(-6, 0, 0));
localTime = originalTime.ToLocalTime();
Console.WriteLine("Converted {0} to {1}.", originalTime.ToString(), localTime.ToString());
originalTime = new DateTimeOffset(2007, 3, 11, 4, 0, 0, new TimeSpan(-6, 0, 0));
localTime = originalTime.ToLocalTime();
Console.WriteLine("Converted {0} to {1}.", originalTime.ToString(), localTime.ToString());
}
}
Related examples in the same category