TimeSpan Methods

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Include Protected Members
Include Inherited Members

Include Silverlight Members
Include Silverlight for Windows Phone Members
Include XNA Framework Members

The TimeSpan type exposes the following members.

Methods

  Name Description
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 Add Returns a new TimeSpan object whose value is the sum of the specified TimeSpan object and this instance.
Public methodStatic memberSupported by Silverlight for Windows PhoneSupported by Xbox 360 Compare Compares two TimeSpan values and returns an integer that indicates whether the first time interval is longer than, equal to, or shorter than the second time interval.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 CompareTo(Object) Compares this instance to a specified object and returns an integer that indicates whether the time interval represented by this instance is longer than, equal to, or shorter than the time interval represented by the specified object.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 CompareTo(TimeSpan) Compares this instance to a specified TimeSpan object and returns an integer that indicates whether the time interval represented by this instance is longer than, equal to, or shorter than the time interval represented by the specified TimeSpan object.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 Duration Returns a new TimeSpan object whose value is the absolute value of the current TimeSpan object.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 Equals(Object) Returns a value indicating whether this instance is equal to a specified object. (Overrides ValueType.Equals(Object).)
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 Equals(TimeSpan) Returns a value indicating whether this instance is equal to a specified TimeSpan object.
Public methodStatic memberSupported by Silverlight for Windows PhoneSupported by Xbox 360 Equals(TimeSpan, TimeSpan) Returns a value indicating whether two specified instances of TimeSpan are equal.
Protected methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 Finalize Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Public methodStatic memberSupported by Silverlight for Windows PhoneSupported by Xbox 360 FromDays Returns a TimeSpan that represents a specified number of days, where the specification is accurate to the nearest millisecond.
Public methodStatic memberSupported by Silverlight for Windows PhoneSupported by Xbox 360 FromHours Returns a TimeSpan that represents a specified number of hours, where the specification is accurate to the nearest millisecond.
Public methodStatic memberSupported by Silverlight for Windows PhoneSupported by Xbox 360 FromMilliseconds Returns a TimeSpan that represents a specified number of milliseconds.
Public methodStatic memberSupported by Silverlight for Windows PhoneSupported by Xbox 360 FromMinutes Returns a TimeSpan that represents a specified number of minutes, where the specification is accurate to the nearest millisecond.
Public methodStatic memberSupported by Silverlight for Windows PhoneSupported by Xbox 360 FromSeconds Returns a TimeSpan that represents a specified number of seconds, where the specification is accurate to the nearest millisecond.
Public methodStatic memberSupported by Silverlight for Windows PhoneSupported by Xbox 360 FromTicks Returns a TimeSpan that represents a specified time, where the specification is in units of ticks.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 GetHashCode Returns a hash code for this instance. (Overrides ValueType.GetHashCode().)
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 GetType Gets the Type of the current instance. (Inherited from Object.)
Protected methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 Negate Returns a new TimeSpan whose value is the negated value of this instance.
Public methodStatic memberSupported by Silverlight for Windows PhoneSupported by Xbox 360 Parse(String) Converts the string representation of a time interval to its TimeSpan equivalent.
Public methodStatic memberSupported by Silverlight for Windows Phone Parse(String, IFormatProvider) Converts the string representation of a time interval to its TimeSpan equivalent by using the specified culture-specific format information.
Public methodStatic memberSupported by Silverlight for Windows Phone ParseExact(String, String, IFormatProvider) Converts the string representation of a time interval to its TimeSpan equivalent by using the specified format and culture-specific format information. The format of the string representation must match the specified format exactly.
Public methodStatic memberSupported by Silverlight for Windows Phone ParseExact(String, array<String[], IFormatProvider) Converts the string representation of a time interval to its TimeSpan equivalent by using the specified array of format strings and culture-specific format information. The format of the string representation must match one of the specified formats exactly.
Public methodStatic memberSupported by Silverlight for Windows Phone ParseExact(String, String, IFormatProvider, TimeSpanStyles) Converts the string representation of a time interval to its TimeSpan equivalent by using the specified format, culture-specific format information, and styles. The format of the string representation must match the specified format exactly.
Public methodStatic memberSupported by Silverlight for Windows Phone ParseExact(String, array<String[], IFormatProvider, TimeSpanStyles) Converts the string representation of a time interval to its TimeSpan equivalent by using the specified formats, culture-specific format information, and styles. The format of the string representation must match one of the specified formats exactly.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 Subtract Returns a new TimeSpan object whose value is the difference between the specified TimeSpan object and this instance.
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 ToString() Converts the value of the current TimeSpan object to its equivalent string representation. (Overrides ValueType.ToString().)
Public methodSupported by Silverlight for Windows Phone ToString(String) Converts the value of the current TimeSpan object to its equivalent string representation by using the specified format.
Public methodSupported by Silverlight for Windows Phone ToString(String, IFormatProvider) Converts the value of the current TimeSpan object to its equivalent string representation by using the specified format and culture-specific formatting information.
Public methodStatic memberSupported by Silverlight for Windows PhoneSupported by Xbox 360 TryParse(String, TimeSpan%) Converts the string representation of a time interval to its TimeSpan equivalent and returns a value that indicates whether the conversion succeeded.
Public methodStatic memberSupported by Silverlight for Windows Phone TryParse(String, IFormatProvider, TimeSpan%) Converts the string representation of a time interval to its TimeSpan equivalent by using the specified culture-specific formatting information, and returns a value that indicates whether the conversion succeeded.
Public methodStatic memberSupported by Silverlight for Windows Phone TryParseExact(String, String, IFormatProvider, TimeSpan%) Converts the string representation of a time interval to its TimeSpan equivalent by using the specified format and culture-specific format information, and returns a value that indicates whether the conversion succeeded. The format of the string representation must match the specified format exactly.
Public methodStatic memberSupported by Silverlight for Windows Phone TryParseExact(String, array<String[], IFormatProvider, TimeSpan%) Converts the specified string representation of a time interval to its TimeSpan equivalent by using the specified formats and culture-specific format information, and returns a value that indicates whether the conversion succeeded. The format of the string representation must match one of the specified formats exactly.
Public methodStatic memberSupported by Silverlight for Windows Phone TryParseExact(String, String, IFormatProvider, TimeSpanStyles, TimeSpan%) Converts the string representation of a time interval to its TimeSpan equivalent by using the specified format, culture-specific format information, and styles, and returns a value that indicates whether the conversion succeeded. The format of the string representation must match the specified format exactly.
Public methodStatic memberSupported by Silverlight for Windows Phone TryParseExact(String, array<String[], IFormatProvider, TimeSpanStyles, TimeSpan%) Converts the specified string representation of a time interval to its TimeSpan equivalent by using the specified formats, culture-specific format information, and styles, and returns a value that indicates whether the conversion succeeded. The format of the string representation must match one of the specified formats exactly.

Top