Subtract time interval from DateTimeOffset, and yields a new date and time in CSharp
Description
The following code shows how to subtract time interval from DateTimeOffset, and yields a new date and time.
Example
//from w w w .j a v a 2 s.c om
using System;
public class MainClass{
public static void Main(String[] argv){
DateTimeOffset offsetDate = new DateTimeOffset(2014, 12, 3, 11, 30, 0,
new TimeSpan(-8, 0, 0));
TimeSpan duration = new TimeSpan(7, 18, 0, 0);
Console.WriteLine(offsetDate - duration);
}
}
The code above generates the following result.