TimeSpan Structure

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Represents a time interval.

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

[<Sealed>]
[<SerializableAttribute>]
type TimeSpan =  struct end

The TimeSpan type exposes the following members.

  NameDescription
Public methodTimeSpan(Int64)Initializes a new TimeSpan to the specified number of ticks.
Public methodTimeSpan(Int32, Int32, Int32)Initializes a new TimeSpan to a specified number of hours, minutes, and seconds.
Public methodTimeSpan(Int32, Int32, Int32, Int32)Initializes a new TimeSpan to a specified number of days, hours, minutes, and seconds.
Public methodTimeSpan(Int32, Int32, Int32, Int32, Int32)Initializes a new TimeSpan to a specified number of days, hours, minutes, seconds, and milliseconds.
Top

  NameDescription
Public propertyDaysGets the days component of the time interval represented by the current TimeSpan structure.
Public propertyHoursGets the hours component of the time interval represented by the current TimeSpan structure.
Public propertyMillisecondsGets the milliseconds component of the time interval represented by the current TimeSpan structure.
Public propertyMinutesGets the minutes component of the time interval represented by the current TimeSpan structure.
Public propertySecondsGets the seconds component of the time interval represented by the current TimeSpan structure.
Public propertyTicksGets the number of ticks that represent the value of the current TimeSpan structure.
Top

  NameDescription
Public methodAddReturns a new TimeSpan object whose value is the sum of the specified TimeSpan object and this instance.
Public methodStatic memberCompareCompares two TimeSpan values and returns an integer that indicates whether the first value is shorter than, equal to, or longer than the second value.
Public methodCompareToCompares this instance to a specified object and returns an integer that indicates whether this instance is shorter than, equal to, or longer than the specified object.
Public methodDurationReturns a new TimeSpan object whose value is the absolute value of the current TimeSpan object.
Public methodEquals(Object)Returns a value indicating whether this instance is equal to a specified object. (Overrides ValueType..::..Equals(Object).)
Public methodStatic memberEquals(TimeSpan, TimeSpan)Returns a value that indicates whether two specified instances of TimeSpan are equal.
Public methodStatic memberFromTicksReturns a TimeSpan that represents a specified time, where the specification is in units of ticks.
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodNegateReturns a new TimeSpan object whose value is the negated value of this instance.
Public methodSubtractReturns a new TimeSpan object whose value is the difference between the specified TimeSpan object and this instance.
Public methodToStringConverts the value of the current TimeSpan object to its equivalent string representation. (Overrides Object..::..ToString()()()().)
Top

  NameDescription
Public operatorStatic memberAdditionAdds two specified TimeSpan instances.
Public operatorStatic memberEqualityIndicates whether two TimeSpan instances are equal.
Public operatorStatic memberGreaterThanIndicates whether a specified TimeSpan is greater than another specified TimeSpan.
Public operatorStatic memberGreaterThanOrEqualIndicates whether a specified TimeSpan is greater than or equal to another specified TimeSpan.
Public operatorStatic memberInequalityIndicates whether two TimeSpan instances are not equal.
Public operatorStatic memberLessThanIndicates whether a specified TimeSpan is less than another specified TimeSpan.
Public operatorStatic memberLessThanOrEqualIndicates whether a specified TimeSpan is less than or equal to another specified TimeSpan.
Public operatorStatic memberSubtractionSubtracts a specified TimeSpan from another specified TimeSpan.
Public operatorStatic memberUnaryNegationReturns a TimeSpan whose value is the negated value of the specified instance.
Public operatorStatic memberUnaryPlusReturns the specified instance of TimeSpan.
Top

  NameDescription
Public fieldStatic memberMaxValueRepresents the maximum TimeSpan value. This field is read-only.
Public fieldStatic memberMinValueRepresents the minimum TimeSpan value. This field is read-only.
Public fieldStatic memberTicksPerDayRepresents the number of ticks in 1 day. This field is constant.
Public fieldStatic memberTicksPerHourRepresents the number of ticks in 1 hour. This field is constant.
Public fieldStatic memberTicksPerMillisecondRepresents the number of ticks in 1 millisecond. This field is constant.
Public fieldStatic memberTicksPerMinuteRepresents the number of ticks in 1 minute. This field is constant.
Public fieldStatic memberTicksPerSecondRepresents the number of ticks in 1 second.
Public fieldStatic memberZeroRepresents the zero TimeSpan value. This field is read-only.
Top

The value of a TimeSpan object is the number of ticks that equal the represented time interval. A tick is equal to 100 nanoseconds, or one ten-millionth of a second. The value of a TimeSpan object can range from TimeSpan..::..MinValue to TimeSpan..::..MaxValue.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show: