mscorlib(4.0.0.0) API with additions
|
Represents a time interval.To browse the .NET Framework source code for this type, see the Reference Source. More...
Public Member Functions | |
TimeSpan (long ticks) | |
Initializes a new instance of the T:System.TimeSpan structure to the specified number of ticks. More... | |
TimeSpan (int hours, int minutes, int seconds) | |
Initializes a new instance of the T:System.TimeSpan structure to a specified number of hours, minutes, and seconds. More... | |
TimeSpan (int days, int hours, int minutes, int seconds) | |
Initializes a new instance of the T:System.TimeSpan structure to a specified number of days, hours, minutes, and seconds. More... | |
TimeSpan (int days, int hours, int minutes, int seconds, int milliseconds) | |
Initializes a new instance of the T:System.TimeSpan structure to a specified number of days, hours, minutes, seconds, and milliseconds. More... | |
TimeSpan | Add (TimeSpan ts) |
Returns a new T:System.TimeSpan object whose value is the sum of the specified T:System.TimeSpan object and this instance. More... | |
int | CompareTo (object value) |
Compares 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. More... | |
int | CompareTo (TimeSpan value) |
Compares this instance to a specified T:System.TimeSpan object and returns an integer that indicates whether this instance is shorter than, equal to, or longer than the T:System.TimeSpan object. More... | |
TimeSpan | Duration () |
Returns a new T:System.TimeSpan object whose value is the absolute value of the current T:System.TimeSpan object. More... | |
override bool | Equals (object value) |
Returns a value indicating whether this instance is equal to a specified object. More... | |
bool | Equals (TimeSpan obj) |
Returns a value indicating whether this instance is equal to a specified T:System.TimeSpan object. More... | |
override int | GetHashCode () |
Returns a hash code for this instance. More... | |
TimeSpan | Negate () |
Returns a new T:System.TimeSpan object whose value is the negated value of this instance. More... | |
TimeSpan | Subtract (TimeSpan ts) |
Returns a new T:System.TimeSpan object whose value is the difference between the specified T:System.TimeSpan object and this instance. More... | |
override string | ToString () |
Converts the value of the current T:System.TimeSpan object to its equivalent string representation. More... | |
string | ToString (string format) |
Converts the value of the current T:System.TimeSpan object to its equivalent string representation by using the specified format. More... | |
string | ToString (string format, IFormatProvider formatProvider) |
Converts the value of the current T:System.TimeSpan object to its equivalent string representation by using the specified format and culture-specific formatting information. More... | |
![]() | |
bool | Equals (T other) |
Indicates whether the current object is equal to another object of the same type. More... | |
Static Public Member Functions | |
static int | Compare (TimeSpan t1, TimeSpan t2) |
Compares two T:System.TimeSpan values and returns an integer that indicates whether the first value is shorter than, equal to, or longer than the second value. More... | |
static TimeSpan | FromDays (double value) |
Returns a T:System.TimeSpan that represents a specified number of days, where the specification is accurate to the nearest millisecond. More... | |
static bool | Equals (TimeSpan t1, TimeSpan t2) |
Returns a value that indicates whether two specified instances of T:System.TimeSpan are equal. More... | |
static TimeSpan | FromHours (double value) |
Returns a T:System.TimeSpan that represents a specified number of hours, where the specification is accurate to the nearest millisecond. More... | |
static TimeSpan | FromMilliseconds (double value) |
Returns a T:System.TimeSpan that represents a specified number of milliseconds. More... | |
static TimeSpan | FromMinutes (double value) |
Returns a T:System.TimeSpan that represents a specified number of minutes, where the specification is accurate to the nearest millisecond. More... | |
static TimeSpan | FromSeconds (double value) |
Returns a T:System.TimeSpan that represents a specified number of seconds, where the specification is accurate to the nearest millisecond. More... | |
static TimeSpan | FromTicks (long value) |
Returns a T:System.TimeSpan that represents a specified time, where the specification is in units of ticks. More... | |
static internal long | TimeToTicks (int hour, int minute, int second) |
static TimeSpan | Parse (string s) |
Converts the string representation of a time interval to its T:System.TimeSpan equivalent. More... | |
static TimeSpan | Parse (string input, IFormatProvider formatProvider) |
Converts the string representation of a time interval to its T:System.TimeSpan equivalent by using the specified culture-specific format information. More... | |
static TimeSpan | ParseExact (string input, string format, IFormatProvider formatProvider) |
Converts the string representation of a time interval to its T:System.TimeSpan equivalent by using the specified format and culture-specific format information. The format of the string representation must match the specified format exactly. More... | |
static TimeSpan | ParseExact (string input, string[] formats, IFormatProvider formatProvider) |
Converts the string representation of a time interval to its T:System.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. More... | |
static TimeSpan | ParseExact (string input, string format, IFormatProvider formatProvider, TimeSpanStyles styles) |
Converts the string representation of a time interval to its T:System.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. More... | |
static TimeSpan | ParseExact (string input, string[] formats, IFormatProvider formatProvider, TimeSpanStyles styles) |
Converts the string representation of a time interval to its T:System.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. More... | |
static bool | TryParse (string s, out TimeSpan result) |
Converts the string representation of a time interval to its T:System.TimeSpan equivalent and returns a value that indicates whether the conversion succeeded. More... | |
static bool | TryParse (string input, IFormatProvider formatProvider, out TimeSpan result) |
Converts the string representation of a time interval to its T:System.TimeSpan equivalent by using the specified culture-specific formatting information, and returns a value that indicates whether the conversion succeeded. More... | |
static bool | TryParseExact (string input, string format, IFormatProvider formatProvider, out TimeSpan result) |
Converts the string representation of a time interval to its T:System.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. More... | |
static bool | TryParseExact (string input, string[] formats, IFormatProvider formatProvider, out TimeSpan result) |
Converts the specified string representation of a time interval to its T:System.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. More... | |
static bool | TryParseExact (string input, string format, IFormatProvider formatProvider, TimeSpanStyles styles, out TimeSpan result) |
Converts the string representation of a time interval to its T:System.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. More... | |
static bool | TryParseExact (string input, string[] formats, IFormatProvider formatProvider, TimeSpanStyles styles, out TimeSpan result) |
Converts the specified string representation of a time interval to its T:System.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. More... | |
static TimeSpan | operator - (TimeSpan t) |
Returns a T:System.TimeSpan whose value is the negated value of the specified instance. More... | |
static TimeSpan | operator - (TimeSpan t1, TimeSpan t2) |
Subtracts a specified T:System.TimeSpan from another specified T:System.TimeSpan. More... | |
static TimeSpan | operator+ (TimeSpan t) |
Returns the specified instance of T:System.TimeSpan. More... | |
static TimeSpan | operator+ (TimeSpan t1, TimeSpan t2) |
Adds two specified T:System.TimeSpan instances. More... | |
static bool | operator== (TimeSpan t1, TimeSpan t2) |
Indicates whether two T:System.TimeSpan instances are equal. More... | |
static bool | operator != (TimeSpan t1, TimeSpan t2) |
Indicates whether two T:System.TimeSpan instances are not equal. More... | |
static bool | operator< (TimeSpan t1, TimeSpan t2) |
Indicates whether a specified T:System.TimeSpan is less than another specified T:System.TimeSpan. More... | |
static bool | operator<= (TimeSpan t1, TimeSpan t2) |
Indicates whether a specified T:System.TimeSpan is less than or equal to another specified T:System.TimeSpan. More... | |
static bool | operator > (TimeSpan t1, TimeSpan t2) |
Indicates whether a specified T:System.TimeSpan is greater than another specified T:System.TimeSpan. More... | |
static bool | operator >= (TimeSpan t1, TimeSpan t2) |
Indicates whether a specified T:System.TimeSpan is greater than or equal to another specified T:System.TimeSpan. More... | |
Public Attributes | |
const long | TicksPerMillisecond = 10000L |
Represents the number of ticks in 1 millisecond. This field is constant. More... | |
const long | TicksPerSecond = 10000000L |
Represents the number of ticks in 1 second. More... | |
const long | TicksPerMinute = 600000000L |
Represents the number of ticks in 1 minute. This field is constant. More... | |
const long | TicksPerHour = 36000000000L |
Represents the number of ticks in 1 hour. This field is constant. More... | |
const long | TicksPerDay = 864000000000L |
Represents the number of ticks in 1 day. This field is constant. More... | |
internal const long | MaxSeconds = 922337203685L |
internal const long | MinSeconds = -922337203685L |
internal const long | MaxMilliSeconds = 922337203685477L |
internal const long | MinMilliSeconds = -922337203685477L |
internal const long | TicksPerTenthSecond = 1000000L |
internal long | _ticks |
Static Public Attributes | |
static readonly TimeSpan | Zero = new TimeSpan(0L) |
Represents the zero T:System.TimeSpan value. This field is read-only. More... | |
static readonly TimeSpan | MaxValue = new TimeSpan(long.MaxValue) |
Represents the maximum T:System.TimeSpan value. This field is read-only. More... | |
static readonly TimeSpan | MinValue = new TimeSpan(long.MinValue) |
Represents the minimum T:System.TimeSpan value. This field is read-only. More... | |
Properties | |
long | Ticks [get] |
Gets the number of ticks that represent the value of the current T:System.TimeSpan structure. More... | |
int | Days [get] |
Gets the days component of the time interval represented by the current T:System.TimeSpan structure. More... | |
int | Hours [get] |
Gets the hours component of the time interval represented by the current T:System.TimeSpan structure. More... | |
int | Milliseconds [get] |
Gets the milliseconds component of the time interval represented by the current T:System.TimeSpan structure. More... | |
int | Minutes [get] |
Gets the minutes component of the time interval represented by the current T:System.TimeSpan structure. More... | |
int | Seconds [get] |
Gets the seconds component of the time interval represented by the current T:System.TimeSpan structure. More... | |
double | TotalDays [get] |
Gets the value of the current T:System.TimeSpan structure expressed in whole and fractional days. More... | |
double | TotalHours [get] |
Gets the value of the current T:System.TimeSpan structure expressed in whole and fractional hours. More... | |
double | TotalMilliseconds [get] |
Gets the value of the current T:System.TimeSpan structure expressed in whole and fractional milliseconds. More... | |
double | TotalMinutes [get] |
Gets the value of the current T:System.TimeSpan structure expressed in whole and fractional minutes. More... | |
double | TotalSeconds [get] |
Gets the value of the current T:System.TimeSpan structure expressed in whole and fractional seconds. More... | |
Represents a time interval.To browse the .NET Framework source code for this type, see the Reference Source.
Definition at line 12 of file TimeSpan.cs.
System.TimeSpan.TimeSpan | ( | long | ticks | ) |
Initializes a new instance of the T:System.TimeSpan structure to the specified number of ticks.
ticks | A time period expressed in 100-nanosecond units. |
Definition at line 237 of file TimeSpan.cs.
System.TimeSpan.TimeSpan | ( | int | hours, |
int | minutes, | ||
int | seconds | ||
) |
Initializes a new instance of the T:System.TimeSpan structure to a specified number of hours, minutes, and seconds.
hours | Number of hours. |
minutes | Number of minutes. |
seconds | Number of seconds. |
T:System.ArgumentOutOfRangeException | The parameters specify a T:System.TimeSpan value less than F:System.TimeSpan.MinValue or greater than F:System.TimeSpan.MaxValue. |
Definition at line 248 of file TimeSpan.cs.
System.TimeSpan.TimeSpan | ( | int | days, |
int | hours, | ||
int | minutes, | ||
int | seconds | ||
) |
Initializes a new instance of the T:System.TimeSpan structure to a specified number of days, hours, minutes, and seconds.
days | Number of days. |
hours | Number of hours. |
minutes | Number of minutes. |
seconds | Number of seconds. |
T:System.ArgumentOutOfRangeException | The parameters specify a T:System.TimeSpan value less than F:System.TimeSpan.MinValue or greater than F:System.TimeSpan.MaxValue. |
Definition at line 260 of file TimeSpan.cs.
System.TimeSpan.TimeSpan | ( | int | days, |
int | hours, | ||
int | minutes, | ||
int | seconds, | ||
int | milliseconds | ||
) |
Initializes a new instance of the T:System.TimeSpan structure to a specified number of days, hours, minutes, seconds, and milliseconds.
days | Number of days. |
hours | Number of hours. |
minutes | Number of minutes. |
seconds | Number of seconds. |
milliseconds | Number of milliseconds. |
T:System.ArgumentOutOfRangeException | The parameters specify a T:System.TimeSpan value less than F:System.TimeSpan.MinValue or greater than F:System.TimeSpan.MaxValue. |
Definition at line 273 of file TimeSpan.cs.
Returns a new T:System.TimeSpan object whose value is the sum of the specified T:System.TimeSpan object and this instance.
ts | The time interval to add. |
T:System.OverflowException | The resulting T:System.TimeSpan is less than F:System.TimeSpan.MinValue or greater than F:System.TimeSpan.MaxValue. |
Definition at line 289 of file TimeSpan.cs.
Compares two T:System.TimeSpan values and returns an integer that indicates whether the first value is shorter than, equal to, or longer than the second value.
t1 | The first time interval to compare. |
t2 | The second time interval to compare. |
Definition at line 307 of file TimeSpan.cs.
int System.TimeSpan.CompareTo | ( | object | value | ) |
Compares 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.
value | An object to compare, or null . |
null
. T:System.ArgumentException | value is not a T:System.TimeSpan. |
Definition at line 326 of file TimeSpan.cs.
int System.TimeSpan.CompareTo | ( | TimeSpan | value | ) |
Compares this instance to a specified T:System.TimeSpan object and returns an integer that indicates whether this instance is shorter than, equal to, or longer than the T:System.TimeSpan object.
value | An object to compare to this instance. |
Definition at line 352 of file TimeSpan.cs.
TimeSpan System.TimeSpan.Duration | ( | ) |
Returns a new T:System.TimeSpan object whose value is the absolute value of the current T:System.TimeSpan object.
T:System.OverflowException | The value of this instance is F:System.TimeSpan.MinValue. |
Definition at line 385 of file TimeSpan.cs.
override bool System.TimeSpan.Equals | ( | object | value | ) |
Returns a value indicating whether this instance is equal to a specified object.
value | An object to compare with this instance. |
true
if value is a T:System.TimeSpan object that represents the same time interval as the current T:System.TimeSpan structure; otherwise, false
.Definition at line 399 of file TimeSpan.cs.
bool System.TimeSpan.Equals | ( | TimeSpan | obj | ) |
Returns a value indicating whether this instance is equal to a specified T:System.TimeSpan object.
obj | An object to compare with this instance. |
true
if obj represents the same time interval as this instance; otherwise, false
.Definition at line 413 of file TimeSpan.cs.
Returns a value that indicates whether two specified instances of T:System.TimeSpan are equal.
t1 | The first time interval to compare. |
t2 | The second time interval to compare. |
true
if the values of t1 and t2 are equal; otherwise, false
.Definition at line 424 of file TimeSpan.cs.
|
static |
Returns a T:System.TimeSpan that represents a specified number of days, where the specification is accurate to the nearest millisecond.
value | A number of days, accurate to the nearest millisecond. |
T:System.OverflowException | value is less than F:System.TimeSpan.MinValue or greater than F:System.TimeSpan.MaxValue. -or- value is F:System.Double.PositiveInfinity.-or- value is F:System.Double.NegativeInfinity. |
T:System.ArgumentException | value is equal to F:System.Double.NaN. |
Definition at line 376 of file TimeSpan.cs.
|
static |
Returns a T:System.TimeSpan that represents a specified number of hours, where the specification is accurate to the nearest millisecond.
value | A number of hours accurate to the nearest millisecond. |
T:System.OverflowException | value is less than F:System.TimeSpan.MinValue or greater than F:System.TimeSpan.MaxValue. -or- value is F:System.Double.PositiveInfinity.-or- value is F:System.Double.NegativeInfinity. |
T:System.ArgumentException | value is equal to F:System.Double.NaN. |
Definition at line 447 of file TimeSpan.cs.
|
static |
Returns a T:System.TimeSpan that represents a specified number of milliseconds.
value | A number of milliseconds. |
T:System.OverflowException | value is less than F:System.TimeSpan.MinValue or greater than F:System.TimeSpan.MaxValue.-or- value is F:System.Double.PositiveInfinity.-or- value is F:System.Double.NegativeInfinity. |
T:System.ArgumentException | value is equal to F:System.Double.NaN. |
Definition at line 477 of file TimeSpan.cs.
|
static |
Returns a T:System.TimeSpan that represents a specified number of minutes, where the specification is accurate to the nearest millisecond.
value | A number of minutes, accurate to the nearest millisecond. |
T:System.OverflowException | value is less than F:System.TimeSpan.MinValue or greater than F:System.TimeSpan.MaxValue.-or- value is F:System.Double.PositiveInfinity.-or- value is F:System.Double.NegativeInfinity. |
T:System.ArgumentException | value is equal to F:System.Double.NaN. |
Definition at line 492 of file TimeSpan.cs.
|
static |
Returns a T:System.TimeSpan that represents a specified number of seconds, where the specification is accurate to the nearest millisecond.
value | A number of seconds, accurate to the nearest millisecond. |
T:System.OverflowException | value is less than F:System.TimeSpan.MinValue or greater than F:System.TimeSpan.MaxValue.-or- value is F:System.Double.PositiveInfinity.-or- value is F:System.Double.NegativeInfinity. |
T:System.ArgumentException | value is equal to F:System.Double.NaN. |
Definition at line 520 of file TimeSpan.cs.
|
static |
Returns a T:System.TimeSpan that represents a specified time, where the specification is in units of ticks.
value | A number of ticks that represent a time. |
Definition at line 545 of file TimeSpan.cs.
override int System.TimeSpan.GetHashCode | ( | ) |
Returns a hash code for this instance.
Definition at line 432 of file TimeSpan.cs.
TimeSpan System.TimeSpan.Negate | ( | ) |
Returns a new T:System.TimeSpan object whose value is the negated value of this instance.
T:System.OverflowException | The negated value of this instance cannot be represented by a T:System.TimeSpan; that is, the value of this instance is F:System.TimeSpan.MinValue. |
Definition at line 501 of file TimeSpan.cs.
Indicates whether two T:System.TimeSpan instances are not equal.
t1 | The first time interval to compare. |
t2 | The second time interval to compare. |
true
if the values of t1 and t2 are not equal; otherwise, false
.Definition at line 841 of file TimeSpan.cs.
Returns a T:System.TimeSpan whose value is the negated value of the specified instance.
t | The time interval to be negated. |
T:System.OverflowException | The negated value of this instance cannot be represented by a T:System.TimeSpan; that is, the value of this instance is F:System.TimeSpan.MinValue. |
Definition at line 784 of file TimeSpan.cs.
Subtracts a specified T:System.TimeSpan from another specified T:System.TimeSpan.
t1 | The minuend. |
t2 | The subtrahend. |
T:System.OverflowException | The return value is less than F:System.TimeSpan.MinValue or greater than F:System.TimeSpan.MaxValue. |
Definition at line 799 of file TimeSpan.cs.
Indicates whether a specified T:System.TimeSpan is greater than another specified T:System.TimeSpan.
t1 | The first time interval to compare. |
t2 | The second time interval to compare. |
true
if the value of t1 is greater than the value of t2 ; otherwise, false
.Definition at line 874 of file TimeSpan.cs.
Indicates whether a specified T:System.TimeSpan is greater than or equal to another specified T:System.TimeSpan.
t1 | The first time interval to compare. |
t2 | The second time interval to compare. |
true
if the value of t1 is greater than or equal to the value of t2 ; otherwise, false
.Definition at line 885 of file TimeSpan.cs.
Returns the specified instance of T:System.TimeSpan.
t | The time interval to return. |
Definition at line 808 of file TimeSpan.cs.
Adds two specified T:System.TimeSpan instances.
t1 | The first time interval to add. |
t2 | The second time interval to add. |
T:System.OverflowException | The resulting T:System.TimeSpan is less than F:System.TimeSpan.MinValue or greater than F:System.TimeSpan.MaxValue. |
Definition at line 819 of file TimeSpan.cs.
Indicates whether a specified T:System.TimeSpan is less than another specified T:System.TimeSpan.
t1 | The first time interval to compare. |
t2 | The second time interval to compare. |
true
if the value of t1 is less than the value of t2 ; otherwise, false
.Definition at line 852 of file TimeSpan.cs.
Indicates whether a specified T:System.TimeSpan is less than or equal to another specified T:System.TimeSpan.
t1 | The first time interval to compare. |
t2 | The second time interval to compare. |
true
if the value of t1 is less than or equal to the value of t2 ; otherwise, false
.Definition at line 863 of file TimeSpan.cs.
Indicates whether two T:System.TimeSpan instances are equal.
t1 | The first time interval to compare. |
t2 | The second time interval to compare. |
true
if the values of t1 and t2 are equal; otherwise, false
.Definition at line 830 of file TimeSpan.cs.
|
static |
Converts the string representation of a time interval to its T:System.TimeSpan equivalent.
s | A string that specifies the time interval to convert. |
T:System.ArgumentNullException | s is null . |
T:System.FormatException | s has an invalid format. |
T:System.OverflowException | s represents a number that is less than F:System.TimeSpan.MinValue or greater than F:System.TimeSpan.MaxValue.-or- At least one of the days, hours, minutes, or seconds components is outside its valid range. |
Definition at line 570 of file TimeSpan.cs.
|
static |
Converts the string representation of a time interval to its T:System.TimeSpan equivalent by using the specified culture-specific format information.
input | A string that specifies the time interval to convert. |
formatProvider | An object that supplies culture-specific formatting information. |
T:System.ArgumentNullException | input is null . |
T:System.FormatException | input has an invalid format. |
T:System.OverflowException | input represents a number that is less than F:System.TimeSpan.MinValue or greater than F:System.TimeSpan.MaxValue.-or- At least one of the days, hours, minutes, or seconds components in input is outside its valid range. |
Definition at line 586 of file TimeSpan.cs.
|
static |
Converts the string representation of a time interval to its T:System.TimeSpan equivalent by using the specified format and culture-specific format information. The format of the string representation must match the specified format exactly.
input | A string that specifies the time interval to convert. |
format | A standard or custom format string that defines the required format of input . |
formatProvider | An object that provides culture-specific formatting information. |
T:System.ArgumentNullException | input is null . |
T:System.FormatException | input has an invalid format. |
T:System.OverflowException | input represents a number that is less than F:System.TimeSpan.MinValue or greater than F:System.TimeSpan.MaxValue.-or- At least one of the days, hours, minutes, or seconds components in input is outside its valid range. |
Definition at line 603 of file TimeSpan.cs.
|
static |
Converts the string representation of a time interval to its T:System.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.
input | A string that specifies the time interval to convert. |
formats | A array of standard or custom format strings that defines the required format of input . |
formatProvider | An object that provides culture-specific formatting information. |
T:System.ArgumentNullException | input is null . |
T:System.FormatException | input has an invalid format. |
T:System.OverflowException | input represents a number that is less than F:System.TimeSpan.MinValue or greater than F:System.TimeSpan.MaxValue.-or- At least one of the days, hours, minutes, or seconds components in input is outside its valid range. |
Definition at line 620 of file TimeSpan.cs.
|
static |
Converts the string representation of a time interval to its T:System.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.
input | A string that specifies the time interval to convert. |
format | A standard or custom format string that defines the required format of input . |
formatProvider | An object that provides culture-specific formatting information. |
styles | A bitwise combination of enumeration values that defines the style elements that may be present in input . |
T:System.ArgumentException | styles is an invalid T:System.Globalization.TimeSpanStyles value. |
T:System.ArgumentNullException | input is null . |
T:System.FormatException | input has an invalid format. |
T:System.OverflowException | input represents a number that is less than F:System.TimeSpan.MinValue or greater than F:System.TimeSpan.MaxValue.-or- At least one of the days, hours, minutes, or seconds components in input is outside its valid range. |
Definition at line 640 of file TimeSpan.cs.
|
static |
Converts the string representation of a time interval to its T:System.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.
input | A string that specifies the time interval to convert. |
formats | A array of standard or custom format strings that define the required format of input . |
formatProvider | An object that provides culture-specific formatting information. |
styles | A bitwise combination of enumeration values that defines the style elements that may be present in input. |
T:System.ArgumentException | styles is an invalid T:System.Globalization.TimeSpanStyles value. |
T:System.ArgumentNullException | input is null . |
T:System.FormatException | input has an invalid format. |
T:System.OverflowException | input represents a number that is less than F:System.TimeSpan.MinValue or greater than F:System.TimeSpan.MaxValue.-or- At least one of the days, hours, minutes, or seconds components in input is outside its valid range. |
Definition at line 661 of file TimeSpan.cs.
Returns a new T:System.TimeSpan object whose value is the difference between the specified T:System.TimeSpan object and this instance.
ts | The time interval to be subtracted. |
T:System.OverflowException | The return value is less than F:System.TimeSpan.MinValue or greater than F:System.TimeSpan.MaxValue. |
Definition at line 531 of file TimeSpan.cs.
override string System.TimeSpan.ToString | ( | ) |
Converts the value of the current T:System.TimeSpan object to its equivalent string representation.
Definition at line 749 of file TimeSpan.cs.
string System.TimeSpan.ToString | ( | string | format | ) |
Converts the value of the current T:System.TimeSpan object to its equivalent string representation by using the specified format.
format | A standard or custom T:System.TimeSpan format string. |
T:System.FormatException | The format parameter is not recognized or is not supported. |
Definition at line 759 of file TimeSpan.cs.
string System.TimeSpan.ToString | ( | string | format, |
IFormatProvider | formatProvider | ||
) |
Converts the value of the current T:System.TimeSpan object to its equivalent string representation by using the specified format and culture-specific formatting information.
format | A standard or custom T:System.TimeSpan format string. |
formatProvider | An object that supplies culture-specific formatting information. |
T:System.FormatException | The format parameter is not recognized or is not supported. |
Implements System.IFormattable.
Definition at line 770 of file TimeSpan.cs.
|
static |
Converts the string representation of a time interval to its T:System.TimeSpan equivalent and returns a value that indicates whether the conversion succeeded.
s | A string that specifies the time interval to convert. |
result | When this method returns, contains an object that represents the time interval specified by s , or F:System.TimeSpan.Zero if the conversion failed. This parameter is passed uninitialized. |
true
if s was converted successfully; otherwise, false
. This operation returns false
if the s parameter is null
or F:System.String.Empty, has an invalid format, represents a time interval that is less than F:System.TimeSpan.MinValue or greater than F:System.TimeSpan.MaxValue, or has at least one days, hours, minutes, or seconds component outside its valid range.Definition at line 673 of file TimeSpan.cs.
|
static |
Converts the string representation of a time interval to its T:System.TimeSpan equivalent by using the specified culture-specific formatting information, and returns a value that indicates whether the conversion succeeded.
input | A string that specifies the time interval to convert. |
formatProvider | An object that supplies culture-specific formatting information. |
result | When this method returns, contains an object that represents the time interval specified by input , or F:System.TimeSpan.Zero if the conversion failed. This parameter is passed uninitialized. |
true
if input was converted successfully; otherwise, false
. This operation returns false
if the input parameter is null
or F:System.String.Empty, has an invalid format, represents a time interval that is less than F:System.TimeSpan.MinValue or greater than F:System.TimeSpan.MaxValue, or has at least one days, hours, minutes, or seconds component outside its valid range.Definition at line 685 of file TimeSpan.cs.
|
static |
Converts the string representation of a time interval to its T:System.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.
input | A string that specifies the time interval to convert. |
format | A standard or custom format string that defines the required format of input . |
formatProvider | An object that supplies culture-specific formatting information. |
result | When this method returns, contains an object that represents the time interval specified by input , or F:System.TimeSpan.Zero if the conversion failed. This parameter is passed uninitialized. |
true
if input was converted successfully; otherwise, false
.Definition at line 698 of file TimeSpan.cs.
|
static |
Converts the specified string representation of a time interval to its T:System.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.
input | A string that specifies the time interval to convert. |
formats | A array of standard or custom format strings that define the acceptable formats of input . |
formatProvider | An object that provides culture-specific formatting information. |
result | When this method returns, contains an object that represents the time interval specified by input , or F:System.TimeSpan.Zero if the conversion failed. This parameter is passed uninitialized. |
true
if input was converted successfully; otherwise, false
.Definition at line 711 of file TimeSpan.cs.
|
static |
Converts the string representation of a time interval to its T:System.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.
input | A string that specifies the time interval to convert. |
format | A standard or custom format string that defines the required format of input . |
formatProvider | An object that provides culture-specific formatting information. |
styles | One or more enumeration values that indicate the style of input . |
result | When this method returns, contains an object that represents the time interval specified by input , or F:System.TimeSpan.Zero if the conversion failed. This parameter is passed uninitialized. |
true
if input was converted successfully; otherwise, false
.Definition at line 725 of file TimeSpan.cs.
|
static |
Converts the specified string representation of a time interval to its T:System.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.
input | A string that specifies the time interval to convert. |
formats | A array of standard or custom format strings that define the acceptable formats of input . |
formatProvider | An object that supplies culture-specific formatting information. |
styles | One or more enumeration values that indicate the style of input . |
result | When this method returns, contains an object that represents the time interval specified by input , or F:System.TimeSpan.Zero if the conversion failed. This parameter is passed uninitialized. |
true
if input was converted successfully; otherwise, false
.Definition at line 740 of file TimeSpan.cs.
Represents the maximum T:System.TimeSpan value. This field is read-only.
Definition at line 68 of file TimeSpan.cs.
Represents the minimum T:System.TimeSpan value. This field is read-only.
Definition at line 72 of file TimeSpan.cs.
const long System.TimeSpan.TicksPerDay = 864000000000L |
Represents the number of ticks in 1 day. This field is constant.
Definition at line 40 of file TimeSpan.cs.
const long System.TimeSpan.TicksPerHour = 36000000000L |
Represents the number of ticks in 1 hour. This field is constant.
Definition at line 34 of file TimeSpan.cs.
const long System.TimeSpan.TicksPerMillisecond = 10000L |
Represents the number of ticks in 1 millisecond. This field is constant.
Definition at line 16 of file TimeSpan.cs.
const long System.TimeSpan.TicksPerMinute = 600000000L |
Represents the number of ticks in 1 minute. This field is constant.
Definition at line 28 of file TimeSpan.cs.
const long System.TimeSpan.TicksPerSecond = 10000000L |
Represents the number of ticks in 1 second.
Definition at line 22 of file TimeSpan.cs.
Represents the zero T:System.TimeSpan value. This field is read-only.
Definition at line 64 of file TimeSpan.cs.
|
get |
Gets the days component of the time interval represented by the current T:System.TimeSpan structure.
Definition at line 96 of file TimeSpan.cs.
|
get |
Gets the hours component of the time interval represented by the current T:System.TimeSpan structure.
Definition at line 108 of file TimeSpan.cs.
|
get |
Gets the milliseconds component of the time interval represented by the current T:System.TimeSpan structure.
Definition at line 120 of file TimeSpan.cs.
|
get |
Gets the minutes component of the time interval represented by the current T:System.TimeSpan structure.
Definition at line 132 of file TimeSpan.cs.
|
get |
Gets the seconds component of the time interval represented by the current T:System.TimeSpan structure.
Definition at line 144 of file TimeSpan.cs.
|
get |
Gets the number of ticks that represent the value of the current T:System.TimeSpan structure.
Definition at line 84 of file TimeSpan.cs.
|
get |
Gets the value of the current T:System.TimeSpan structure expressed in whole and fractional days.
Definition at line 156 of file TimeSpan.cs.
|
get |
Gets the value of the current T:System.TimeSpan structure expressed in whole and fractional hours.
Definition at line 168 of file TimeSpan.cs.
|
get |
Gets the value of the current T:System.TimeSpan structure expressed in whole and fractional milliseconds.
Definition at line 180 of file TimeSpan.cs.
|
get |
Gets the value of the current T:System.TimeSpan structure expressed in whole and fractional minutes.
Definition at line 201 of file TimeSpan.cs.
|
get |
Gets the value of the current T:System.TimeSpan structure expressed in whole and fractional seconds.
Definition at line 213 of file TimeSpan.cs.