Edit

Share via


TimeOnly Constructors

Definition

Overloads

TimeOnly(Int64)

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

TimeOnly(Int32, Int32)

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

TimeOnly(Int32, Int32, Int32)

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

TimeOnly(Int32, Int32, Int32, Int32)

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

TimeOnly(Int32, Int32, Int32, Int32, Int32)

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

TimeOnly(Int64)

Source:
TimeOnly.cs
Source:
TimeOnly.cs
Source:
TimeOnly.cs

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

C#
public TimeOnly(long ticks);

Parameters

ticks
Int64

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

Applies to

.NET 9 and other versions
Product Versions
.NET 6, 7, 8, 9

TimeOnly(Int32, Int32)

Source:
TimeOnly.cs
Source:
TimeOnly.cs
Source:
TimeOnly.cs

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

C#
public TimeOnly(int hour, int minute);

Parameters

hour
Int32

The hours (0 through 23).

minute
Int32

The minutes (0 through 59).

Applies to

.NET 9 and other versions
Product Versions
.NET 6, 7, 8, 9

TimeOnly(Int32, Int32, Int32)

Source:
TimeOnly.cs
Source:
TimeOnly.cs
Source:
TimeOnly.cs

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

C#
public TimeOnly(int hour, int minute, int second);

Parameters

hour
Int32

The hours (0 through 23).

minute
Int32

The minutes (0 through 59).

second
Int32

The seconds (0 through 59).

Applies to

.NET 9 and other versions
Product Versions
.NET 6, 7, 8, 9

TimeOnly(Int32, Int32, Int32, Int32)

Source:
TimeOnly.cs
Source:
TimeOnly.cs
Source:
TimeOnly.cs

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

C#
public TimeOnly(int hour, int minute, int second, int millisecond);

Parameters

hour
Int32

The hours (0 through 23).

minute
Int32

The minutes (0 through 59).

second
Int32

The seconds (0 through 59).

millisecond
Int32

The millisecond (0 through 999).

Applies to

.NET 9 and other versions
Product Versions
.NET 6, 7, 8, 9

TimeOnly(Int32, Int32, Int32, Int32, Int32)

Source:
TimeOnly.cs
Source:
TimeOnly.cs
Source:
TimeOnly.cs

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

C#
public TimeOnly(int hour, int minute, int second, int millisecond, int microsecond);

Parameters

hour
Int32

The hours (0 through 23).

minute
Int32

The minutes (0 through 59).

second
Int32

The seconds (0 through 59).

millisecond
Int32

The millisecond (0 through 999).

microsecond
Int32

The microsecond (0 through 999).

Applies to

.NET 9 and other versions
Product Versions
.NET 7, 8, 9