DateTime.operator - Method (DateTime, DateTime)

Subtracts one DateTime object from another one, yielding a specific period of time.

Namespace: System
Assembly: mscorlib (in mscorlib.dll)

Syntax

public static TimeSpan operator - (
         DateTime d1,
         DateTime d2
)

Parameters

  • d1
    A DateTime object specifying the date/time value that is the minuend.
  • d2
    A DateTime object specifying the date/time value that is the subtrahend.

Return Value

A TimeSpan object specifying the time period that results from the subtraction of the d2 object from the d1 object.

Version Information

Available in the .NET Micro Framework versions 2.0, 2.5, 3.0, 4.0, 4.1, and 4.2.

See Also

Reference

DateTime Structure
DateTime Members
System Namespace