Use TimeSpan methods to extract, use, and evaluate intervals of time in your
automations.
Compare methods
Method | Description |
Compare | Compares two TimeSpan values and returns
an integer that indicates whether the first value is shorter than,
equal to, or longer than the second value. |
Equals | Returns a value that indicates whether two instances of
TimeSpan are equal. |
Convert methods
Method | Description |
Parse | Converts the string representation of a time interval to its
TimeSpan equivalent. |
TryParse | Converts the specified string representation of a time interval
to its TimeSpan equivalent and returns a
value that indicates whether the conversion succeeded. |
Extract methods
Method | Description |
Days | Gets the days component of the time interval that is represented
by the current TimeSpan structure. |
FromDays | Returns a TimeSpan that represents a specified number of days,
where the specification is accurate to the nearest
millisecond. |
FromHours | Returns a TimeSpan that represents a specified number of hours,
where the specification is accurate to the nearest
millisecond. |
FromMilliseconds | Returns a TimeSpan that represents a specified number of
milliseconds. |
FromMinutes | Returns a TimeSpan that represents a specified number of minutes,
where the specification is accurate to the nearest
millisecond. |
FromSeconds | Returns a TimeSpan that represents a specified number of seconds,
where the specification is accurate to the nearest
millisecond. |
FromTicks | Returns a TimeSpan that represents a specified time, where the
specification is in units of ticks. |
Hours | Gets the hours component of the time interval that is represented
by the current TimeSpan structure. |
Milliseconds | Gets the milliseconds component of the time interval that is
represented by the current TimeSpan structure. |
Minutes | Gets the minutes component of the time interval that is
represented by the current TimeSpan structure. |
Seconds | Gets the seconds component of the time interval that is
represented by the current TimeSpan structure. |
Ticks | Gets the number of ticks that represent the value of the current
TimeSpan structure. |
TotalDays | Gets the value of the current TimeSpan structure expressed in
whole and fractional days. |
TotalHours | Gets the value of the current TimeSpan structure expressed in
whole and fractional hours. |
TotalMilliseconds | Gets the value of the current TimeSpan structure expressed in
whole and fractional milliseconds. |
TotalMinutes | Gets the value of the current TimeSpan structure expressed in
whole and fractional minutes. |
TotalSeconds | Gets the value of the current TimeSpan structure expressed in
whole and fractional seconds. |
Zero (property) | Gets a zero TimeSpan value. |
Format methods
Method | Description |
ToString | Converts the value of the current TimeSpan object to its
equivalent string representation. |
Math methods
Method | Description |
Add | Returns a new TimeSpan object whose value is the sum of the
specified TimeSpan object and this instance. |
Subtract | Returns a new TimeSpan object whose value is the difference
between the specified TimeSpan object and this instance. |