DateTimeOffset::Subtract Method (TimeSpan)
Subtracts a specified time interval from the current DateTimeOffset object.
Assembly: mscorlib (in mscorlib.dll)
- Type: System::TimeSpan
The time interval to subtract.
You can use the Subtract method to subtract more than one kind of time interval (days, hours, minutes, seconds, or milliseconds) in a single operation. Its behavior is identical to the Subtraction(DateTimeOffset, TimeSpan) method, which defines the subtraction operator. The DateTimeOffset structure also supports specialized addition methods (such as AddDays, AddHours, and AddMinutes) that allow you to perform subtraction by assigning a negative value to the method parameter.
This method returns a new DateTimeOffset object. It does not modify the value of the current object by adding timeSpan to its date and time.
Because the current DateTimeOffset object does not represent the date and time in a specific time zone, the method does not consider a particular time zone's adjustment rules when it performs the subtraction.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.