Click or drag to resize
DateTimeSubtraction Operator (DateTime, TimeSpan)
Subtracts a specified time interval from a specified date and time and returns a new date and time.

Namespace: System
Assembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax
C#
public static DateTime operator -(
	DateTime d,
	TimeSpan t
)

Parameters

d
Type: SystemDateTime
The date and time value to subtract from.
t
Type: SystemTimeSpan
The time interval to subtract.

Return Value

Type: DateTime
An object whose value is the value of d minus the value of t.
Exceptions
ExceptionCondition
ArgumentOutOfRangeExceptionThe resulting DateTime is less than MinValue or greater than MaxValue.
See Also