NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

DateTime Subtraction Operator (DateTime, DateTime)

Subtracts a DateTime value from a DateTime value, producing a time interval (TimeSpan).

[C#]
public static TimeSpan operator -(
   DateTime d1,
   DateTime d2
);
[C++]
public: static TimeSpan operator op_Subtraction(
   DateTime d1,
   DateTime d2
);
[JScript]
returnValue = d1 - d2;

[Visual Basic] In Visual Basic, you cannot use the operators defined by a type, nor override them or define your own.

[JScript] In JScript, you can use the operators defined by a type, but you cannot override them or define your own.

Arguments [JScript]

d1
The first DateTime value.
d2
The second DateTime value.

Parameters [C#, C++]

d1
The first DateTime value.
d2
The second DateTime value.

Return Value [C#, C++, JScript]

Returns a DateTime value with a Ticks value equal to the difference of the ticks value.

Remarks [C#, C++, JScript]

This operator subtracts two DateTime values, using a ticks value, and the difference is formatted as a TimeSpan value (d1 and d2: d1- d2).

See Also

DateTime Structure | DateTime Members | System Namespace | DateTime Subtraction Operator Overload List | Ticks | TimeSpan