Adds a specified time interval to a DateTimeOffset object.
using System;
public class DateArithmetic
{
public static void Main()
{
DateTimeOffset takeOff = new DateTimeOffset(2010, 6, 1, 7, 55, 0, new TimeSpan(-5, 0, 0));
DateTimeOffset currentTime = takeOff;
TimeSpan flightTimes = new TimeSpan(2, 25, 0);
Console.WriteLine("Takeoff is scheduled for {0:d} at {0:T}.", takeOff);
currentTime = currentTime.Add(flightTimes);
Console.WriteLine(currentTime);
}
}
Related examples in the same category