System.TimeSpan Members

The members of System.TimeSpan are listed below.

See Also: Inherited members from System.ValueType

Public Constructors

Initializes a new instance of the TimeSpan structure to the specified number of ticks.

Initializes a new instance of the TimeSpan structure to a specified number of hours, minutes, and seconds.

Initializes a new instance of the TimeSpan structure to a specified number of days, hours, minutes, and seconds.

Initializes a new instance of the TimeSpan structure to a specified number of days, hours, minutes, seconds, and milliseconds.

Public Fields

static readonly
MaxValueTimeSpan.

Represents the maximum TimeSpan value. This field is read-only.

static readonly
MinValueTimeSpan.

Represents the minimum TimeSpan value. This field is read-only.

const
TicksPerDaylong (864000000000).

Represents the number of ticks in 1 day. This field is constant.

const
TicksPerHourlong (36000000000).

Represents the number of ticks in 1 hour. This field is constant.

const
TicksPerMillisecondlong (10000).

Represents the number of ticks in 1 millisecond. This field is constant.

const
TicksPerMinutelong (600000000).

Represents the number of ticks in 1 minute. This field is constant.

const
TicksPerSecondlong (10000000).

Represents the number of ticks in 1 second.

static readonly
ZeroTimeSpan.

Represents the zero TimeSpan value. This field is read-only.

Public Properties

[read-only]
Daysint.

Gets the days component of the time interval represented by the current TimeSpan structure.

[read-only]
Hoursint.

Gets the hours component of the time interval represented by the current TimeSpan structure.

[read-only]
Millisecondsint.

Gets the milliseconds component of the time interval represented by the current TimeSpan structure.

[read-only]
Minutesint.

Gets the minutes component of the time interval represented by the current TimeSpan structure.

[read-only]
Secondsint.

Gets the seconds component of the time interval represented by the current TimeSpan structure.

[read-only]
Tickslong.

Gets the number of ticks that represent the value of the current TimeSpan structure.

[read-only]
TotalDaysdouble.

Gets the value of the current TimeSpan structure expressed in whole and fractional days.

[read-only]
TotalHoursdouble.

Gets the value of the current TimeSpan structure expressed in whole and fractional hours.

[read-only]
TotalMillisecondsdouble.

Gets the value of the current TimeSpan structure expressed in whole and fractional milliseconds.

[read-only]
TotalMinutesdouble.

Gets the value of the current TimeSpan structure expressed in whole and fractional minutes.

[read-only]
TotalSecondsdouble.

Gets the value of the current TimeSpan structure expressed in whole and fractional seconds.

Public Methods

Add(TimeSpan) : TimeSpan

Returns a new TimeSpan object whose value is the sum of the specified TimeSpan object and this instance.

static
Compare(TimeSpan, TimeSpan) : int

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.

CompareTo(object) : int

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.

CompareTo(TimeSpan) : int

Compares this instance to a specified TimeSpan object and returns an integer that indicates whether this instance is shorter than, equal to, or longer than the TimeSpan object.

Duration() : TimeSpan

Returns a new TimeSpan object whose value is the absolute value of the current TimeSpan object.

override
Equals(object) : bool

Returns a value indicating whether this instance is equal to a specified object.

Equals(TimeSpan) : bool

Returns a value indicating whether this instance is equal to a specified TimeSpan object.

static
Equals(TimeSpan, TimeSpan) : bool

Returns a value that indicates whether two specified instances of TimeSpan are equal.

static
FromDays(double) : TimeSpan

Returns a TimeSpan that represents a specified number of days, where the specification is accurate to the nearest millisecond.

static
FromHours(double) : TimeSpan

Returns a TimeSpan that represents a specified number of hours, where the specification is accurate to the nearest millisecond.

static
FromMilliseconds(double) : TimeSpan

Returns a TimeSpan that represents a specified number of milliseconds.

static
FromMinutes(double) : TimeSpan

Returns a TimeSpan that represents a specified number of minutes, where the specification is accurate to the nearest millisecond.

static
FromSeconds(double) : TimeSpan

Returns a TimeSpan that represents a specified number of seconds, where the specification is accurate to the nearest millisecond.

static
FromTicks(long) : TimeSpan

Returns a TimeSpan that represents a specified time, where the specification is in units of ticks.

override
GetHashCode() : int

Returns a hash code for this instance.

Negate() : TimeSpan

Returns a new TimeSpan object whose value is the negated value of this instance.

static
Parse(string) : TimeSpan

Converts the string representation of a time interval to its TimeSpan equivalent.

static
Parse(string, IFormatProvider) : TimeSpan

Converts the string representation of a time interval to its TimeSpan equivalent by using the specified culture-specific format information.

static
ParseExact(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. The format of the string representation must match the specified format exactly.

static
ParseExact(string, string[], IFormatProvider) : TimeSpan

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.

static
ParseExact(string, string, IFormatProvider, System.Globalization.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. The format of the string representation must match the specified format exactly.

static
ParseExact(string, string[], IFormatProvider, System.Globalization.TimeSpanStyles) : TimeSpan

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.

Subtract(TimeSpan) : TimeSpan

Returns a new TimeSpan object whose value is the difference between the specified TimeSpan object and this instance.

override
ToString() : string

Converts the value of the current TimeSpan object to its equivalent string representation.

ToString(string) : string

Converts the value of the current TimeSpan object to its equivalent string representation by using the specified format.

ToString(string, IFormatProvider) : string

Converts the value of the current TimeSpan object to its equivalent string representation by using the specified format and culture-specific formatting information.

static
TryParse(string, out TimeSpan) : bool
Documentation for this section has not yet been entered.
static
TryParse(string, IFormatProvider, out TimeSpan) : bool
Documentation for this section has not yet been entered.
static
TryParseExact(string, string, IFormatProvider, out TimeSpan) : bool
Documentation for this section has not yet been entered.
static
TryParseExact(string, string[], IFormatProvider, out TimeSpan) : bool
Documentation for this section has not yet been entered.
static
TryParseExact(string, string, IFormatProvider, System.Globalization.TimeSpanStyles, out TimeSpan) : bool
Documentation for this section has not yet been entered.
static
TryParseExact(string, string[], IFormatProvider, System.Globalization.TimeSpanStyles, out TimeSpan) : bool
Documentation for this section has not yet been entered.

Public Operators

static
Addition(TimeSpan, TimeSpan)

Adds two specified TimeSpan instances.

static
Equality(TimeSpan, TimeSpan)

Indicates whether two TimeSpan instances are equal.

static
GreaterThan(TimeSpan, TimeSpan)

Indicates whether a specified TimeSpan is greater than another specified TimeSpan.

static
GreaterThanOrEqual(TimeSpan, TimeSpan)

Indicates whether a specified TimeSpan is greater than or equal to another specified TimeSpan.

static
Inequality(TimeSpan, TimeSpan)

Indicates whether two TimeSpan instances are not equal.

static
LessThan(TimeSpan, TimeSpan)

Indicates whether a specified TimeSpan is less than another specified TimeSpan.

static
LessThanOrEqual(TimeSpan, TimeSpan)

Indicates whether a specified TimeSpan is less than or equal to another specified TimeSpan.

static
Subtraction(TimeSpan, TimeSpan)

Subtracts a specified TimeSpan from another specified TimeSpan.

static
UnaryNegation

Returns a TimeSpan whose value is the negated value of the specified instance.

static
UnaryPlus

Returns the specified instance of TimeSpan.