DateTimeOffset.Subtract Method (DateTimeOffset)
Assembly: mscorlib (in mscorlib.dll)
This method converts both DateTimeOffset objects to Coordinated Universal Time (UTC) before calculating the time interval that separates them. This removes any effect that different offsets from UTC may have on the comparison.
For languages that support custom operators, you can also perform date and time subtraction by using the subtraction operator. For details, see the Subtraction method.
Because neither the current DateTimeOffset object nor the value parameter represent the date and time in a specific time zone, the method does not consider a particular time zone's adjustment rules when it subtracts dates and times.
The following example illustrates subtraction that uses the method.
.NET FrameworkSupported in: 4.5.2, 4.5.1, 4.5, 4, 3.5 SP1, 3.0 SP1, 2.0 SP1
.NET Framework Client ProfileSupported in: 4, 3.5 SP1
Portable Class LibrarySupported in: Portable Class Library
.NET for Windows Store appsSupported in: Windows 8
.NET for Windows Phone appsSupported in: Windows Phone 8.1, Windows Phone 8, Silverlight 8.1
Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)