TimeSpan Members

The following tables list the members exposed by the TimeSpan type.

Public Constructors

Name Description
Public Method TimeSpan Overloaded. Initializes a new instance of the TimeSpan structure.

Public Fields

Name Description
Public Field Static MaxValue Represents the largest possible value for a TimeSpan object. Note that this field is read-only.
Public Field Static MinValue Represents the smallest possible value for a TimeSpan object. Note that this field is read-only.
Public Field TicksPerDay Specifies the number of ticks in one entire day. Note that the value of this field is constant.
Public Field TicksPerHour Specifies the number of ticks in one hour. Note that the value of this field is constant.
Public Field TicksPerMillisecond Specifies the number of ticks in one millisecond. Note that the value of this field is constant.
Public Field TicksPerMinute Specifies the number of ticks in one minute. Note that the value of this field is constant.
Public Field TicksPerSecond Specifies the number of ticks in one second. Note that the value of this field is constant.
Public Field Static Zero A TimeSpan having a value of 0 (zero). Note that this field is read-only.

Public Properties

Name Description
Public Property Days Gets the number of whole days in the current TimeSpan object (time period).
Public Property Hours Gets the number of whole hours in the current TimeSpan object (time period).
Public Property Milliseconds Gets the number of whole milliseconds in the current TimeSpan object (time period).
Public Property Minutes Gets the number of whole minutes in the current TimeSpan object (time period).
Public Property Seconds Gets the number of whole seconds in the current TimeSpan object (time period).
Public Property Ticks Gets the number of ticks in the current TimeSpan object (time period).

Public Methods

Name Description
Public Method Add Adds a specified TimeSpan object (time period) to the current TimeSpan object, yielding a new TimeSpan object.
Public Method Static Compare Compares two specified TimeSpan objects (time periods) with one another to determine their relative value.
Public Method CompareTo Compares a specified TimeSpan object (time period) or other time-period object with the current TimeSpan object to determine their relative value.
Public Method Duration Returns a new TimeSpan object (time period) that has the absolute value of the current TimeSpan object.
Public Method Equals Overloaded. Determines whether two objects that specify time periods are equal.
Public Method Static FromTicks Returns a TimeSpan object (time period) that is equivalent to a specified number of ticks.
Public Method GetHashCode (Inherited from Object.)
Public Method GetType (Inherited from Object.)
Public Method Negate Returns a new TimeSpan object that has the negated (opposite) value of the current TimeSpan object.
Public Method Static op_UnaryNegation Returns a TimeSpan whose value is the negated value of the specified instance.
Public Method Static op_UnaryPlus Returns the specified instance of TimeSpan.
Public Method Static operator - Subtracts a specified TimeSpan object (time period) from another specified TimeSpan object, yielding a new TimeSpan object.
Public Method Static operator != Determines whether two specified TimeSpan objects (time periods) are not equal.
Public Method Static operator + Adds two specified TimeSpan objects (time periods), yielding a new TimeSpan object.
Public Method Static operator + Unary plus operator.
Public Method Static operator < Determines whether a specified TimeSpan object (time period) is less than another specified TimeSpan object.
Public Method Static operator <= Determines whether a specified TimeSpan object (time period) is less than or equal to another specified TimeSpan object.
Public Method Static operator == Determines whether two specified TimeSpan objects (time periods) are equal.
Public Method Static operator > Determines whether a specified TimeSpan object (time period) is greater than another specified TimeSpan object.
Public Method Static operator >= Determines whether a specified TimeSpan object (time period) is greater than or equal to another specified TimeSpan object.
Public Method ReferenceEquals (Inherited from Object.)
Public Method Subtract Subtracts a specified TimeSpan object (time period) from the current TimeSpan object, yielding a new TimeSpan object.
Public Method ToString Converts the value of the current TimeSpan object (time period) to its equivalent string representation.

See Also

Reference

TimeSpan Structure
System Namespace