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

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

Parameters

d1
Type: SystemDateTime
The date and time value to subtract from (the minuend).
d2
Type: SystemDateTime
The date and time value to subtract (the subtrahend).

Return Value

Type: TimeSpan
The time interval between d1 and d2; that is, d1 minus d2.
See Also