Lua API
On this page

TimeOnly

Tip

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

Represents a time of day, as would be read from a clock, within the range 00:00:00 to 23:59:59.9999999.

Fields:

Hour number

read only

Gets the hour component of the time represented by this instance.

MaxValue TimeOnly

staticread only

Gets the largest possible value of TimeOnly.

Microsecond number

read only

Gets the microsecond component of the time represented by this instance.

Millisecond number

read only

Gets the millisecond component of the time represented by this instance.

Minute number

read only

Gets the minute component of the time represented by this instance.

MinValue TimeOnly

staticread only

Gets the smallest possible value of TimeOnly.

Nanosecond number

read only

Gets the nanosecond component of the time represented by this instance.

Second number

read only

Gets the seconds component of the time represented by this instance.

Ticks number

read only

Gets the number of ticks that represent the time of this instance.

Constructors:

New(ticks: number) :

Initializes a new instance of the TimeOnly structure using a specified number of ticks.

Parameters:
NameTypeDefaultSummary
ticksnumber

A time of day expressed in the number of 100-nanosecond units since 00:00:00.0000000.

New(hour: number, minute: number) :

Initializes a new instance of the TimeOnly structure to the specified hour and the minute.

Parameters:
NameTypeDefaultSummary
hournumber

The hours (0 through 23).

minutenumber

The minutes (0 through 59).

New(hour: number, minute: number, second: number) :

Initializes a new instance of the TimeOnly structure to the specified hour, minute, and second.

Parameters:
NameTypeDefaultSummary
hournumber

The hours (0 through 23).

minutenumber

The minutes (0 through 59).

secondnumber

The seconds (0 through 59).

New(hour: number, minute: number, second: number, millisecond: number) :

Initializes a new instance of the TimeOnly structure to the specified hour, minute, second, and millisecond.

Parameters:
NameTypeDefaultSummary
hournumber

The hours (0 through 23).

minutenumber

The minutes (0 through 59).

secondnumber

The seconds (0 through 59).

millisecondnumber

The millisecond (0 through 999).

New(hour: number, minute: number, second: number, millisecond: number, microsecond: number) :

Initializes a new instance of the TimeOnly structure to the specified hour, minute, second, millisecond, and microsecond.

Parameters:
NameTypeDefaultSummary
hournumber

The hours (0 through 23).

minutenumber

The minutes (0 through 59).

secondnumber

The seconds (0 through 59).

millisecondnumber

The millisecond (0 through 999).

microsecondnumber

The microsecond (0 through 999).

Methods:

Add(value: TimeSpan) : TimeOnly

Returns a new TimeOnly that adds the value of the specified time span to the value of this instance.

Parameters:
NameTypeDefaultSummary
valueTimeSpan

A positive or negative time interval.

Returns:TimeOnly

Add(value: TimeSpan) : TimeOnly, number

Returns a new TimeOnly that adds the value of the specified time span to the value of this instance. If the result wraps past the end of the day, this method returns the number of excess days as an out parameter.

Parameters:
NameTypeDefaultSummary
valueTimeSpan

A positive or negative time interval.

Returns:
TypeSummary
TimeOnly
number

When this method returns, contains the number of excess days, if any, that resulted from wrapping during this addition operation.

AddHours(value: number) : TimeOnly

Returns a new TimeOnly that adds the specified number of hours to the value of this instance.

Parameters:
NameTypeDefaultSummary
valuenumber

A number of whole and fractional hours. The value parameter can be negative or positive.

Returns:TimeOnly

AddHours(value: number) : TimeOnly, number

Returns a new TimeOnly that adds the specified number of hours to the value of this instance. If the result wraps past the end of the day, this method returns the number of excess days as an out parameter.

Parameters:
NameTypeDefaultSummary
valuenumber

A number of whole and fractional hours. The value parameter can be negative or positive.

Returns:
TypeSummary
TimeOnly
number

When this method returns, contains the number of excess days, if any, that resulted from wrapping during this addition operation.

AddMinutes(value: number) : TimeOnly

Returns a new TimeOnly that adds the specified number of minutes to the value of this instance.

Parameters:
NameTypeDefaultSummary
valuenumber

A number of whole and fractional minutes. The value parameter can be negative or positive.

Returns:TimeOnly

AddMinutes(value) value number

CompareTo(value) value Object

CompareTo(value) value TimeOnly

Deconstruct()

Deconstruct()

Deconstruct()

Deconstruct()

FromDateTime(dateTime) dateTime DateTime

FromTimeSpan(timeSpan) timeSpan TimeSpan

IsBetween(start,end) start TimeOnly , end TimeOnly

Parse(s) s string

ParseExact(s,format) s string , format string

ParseExact(s,formats) s string , formats string

ToLongTimeString()

ToShortTimeString()

ToString()

ToString(format) format string

ToTimeSpan()

TryParse(s) s string

TryParseExact(s,format) s string , format string

TryParseExact(s,formats) s string , formats string