다음을 통해 공유


TimeSpan Structure

Specifies a discrete period of time, or a time span.

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

Syntax

public struct TimeSpan

Remarks

A TimeSpan object represents a specific period of time, expressed as a positive or negative number of days, hours, minutes, seconds, and fractions of a second. The largest unit of measure that .NET Micro Framework uses to represent time periods is a day. For the sake of consistency, time spans are measured in days because the number of days in larger units of time, such as months and years, varies.

The value of a TimeSpan object is the number of ticks that equal the specified time period. A tick is equal to 100 nanoseconds, and the value of a TimeSpan object can range from the value in the MinValue field to the value in the MaxValue field.

A TimeSpan value can be represented as [-]d.hh:mm:ss.ff, where the optional minus sign (–) indicates a negative time period, the d component is days, hh is hours as measured on a 24-hour clock, mm is minutes, ss is seconds, and ff is fractions of a second. That is, a time period consists of a positive or negative number of whole days, a positive or negative number of whole and partial days, or a positive or negative partial day. For example, the text representation of a TimeSpan object initialized to 1.0e+13 ticks is "11.13:46:40", which equates to 11 days, 13 hours, 46 minutes, and 40 seconds.

Version Information

Available in the .NET Micro Framework versions 2.0, 2.5, 3.0, 4.0, and 4.1.

See Also

Reference

TimeSpan Members
System Namespace