Lua API
On this page

TimeSpan

Tip

This is a builtin dotnet type. The documentation and api interface are generated from dotnet source files.

Represents a time interval.

Fields:

Days number

read only

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

Hours number

read only

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

MaxValue TimeSpan

staticread only

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

Microseconds number

read only

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

Milliseconds number

read only

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

Minutes number

read only

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

MinValue TimeSpan

staticread only

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

Nanoseconds number

read only

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

NanosecondsPerTick number

static

Represents the number of nanoseconds per tick. This field is constant.

Seconds number

read only

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

Ticks number

read only

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

TicksPerDay number

static

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

TicksPerHour number

static

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

TicksPerMicrosecond number

static

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

TicksPerMillisecond number

static

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

TicksPerMinute number

static

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

TicksPerSecond number

static

Represents the number of ticks in 1 second.

TotalDays number

read only

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

TotalHours number

read only

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

TotalMicroseconds number

read only

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

TotalMilliseconds number

read only

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

TotalMinutes number

read only

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

TotalNanoseconds number

read only

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

TotalSeconds number

read only

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

Zero TimeSpan

staticread only

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

Constructors:

New(ticks: number) :

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

Parameters:
NameTypeDefaultSummary
ticksnumber

A time period expressed in 100-nanosecond units.

New(hours: number, minutes: number, seconds: number) :

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

Parameters:
NameTypeDefaultSummary
hoursnumber

Number of hours.

minutesnumber

Number of minutes.

secondsnumber

Number of seconds.

New(days: number, hours: number, minutes: number, seconds: number) :

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

Parameters:
NameTypeDefaultSummary
daysnumber

Number of days.

hoursnumber

Number of hours.

minutesnumber

Number of minutes.

secondsnumber

Number of seconds.

New(days: number, hours: number, minutes: number, seconds: number, milliseconds: number) :

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

Parameters:
NameTypeDefaultSummary
daysnumber

Number of days.

hoursnumber

Number of hours.

minutesnumber

Number of minutes.

secondsnumber

Number of seconds.

millisecondsnumber

Number of milliseconds.

New(days: number, hours: number, minutes: number, seconds: number, milliseconds: number, microseconds: number) :

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

Parameters:
NameTypeDefaultSummary
daysnumber

Number of days.

hoursnumber

Number of hours.

minutesnumber

Number of minutes.

secondsnumber

Number of seconds.

millisecondsnumber

Number of milliseconds.

microsecondsnumber

Number of microseconds.

Methods:

Add(ts: TimeSpan) : TimeSpan

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

Parameters:
NameTypeDefaultSummary
tsTimeSpan

The time interval to add.

Returns:TimeSpan

Compare(t1: TimeSpan, t2: TimeSpan) : number

static

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.

Parameters:
NameTypeDefaultSummary
t1TimeSpan

The first time interval to compare.

t2TimeSpan

The second time interval to compare.

Returns:number

CompareTo(value?: Object) : number

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.

Parameters:
NameTypeDefaultSummary
valueObject

An object to compare, or null.

Returns:number

CompareTo(value: TimeSpan) : number

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.

Parameters:
NameTypeDefaultSummary
valueTimeSpan

An object to compare to this instance.

Returns:number

Divide(divisor: number) : TimeSpan

Returns a new TimeSpan object whose value is the result of dividing this instance by the specified divisor.

Parameters:
NameTypeDefaultSummary
divisornumber

The value to be divided by.

Returns:TimeSpan

Divide(ts) ts TimeSpan

Duration()

FromDays(value) value number

FromHours(value) value number

FromMicroseconds(value) value number

FromMilliseconds(value) value number

FromMinutes(value) value number

FromSeconds(value) value number

FromTicks(value) value number

Multiply(factor) factor number

Negate()

Parse(s) s string

Subtract(ts) ts TimeSpan

ToString()

ToString(format) format string

TryParse(s) s string