Читати англійською Редагувати

Поділитися через


DateOnly.ToDateTime Method

Definition

Overloads

ToDateTime(TimeOnly)

Returns a DateTime that is set to the date of this DateOnly instance and the time of specified input time.

ToDateTime(TimeOnly, DateTimeKind)

Returns a DateTime instance with the specified input kind that is set to the date of this DateOnly instance and the time of specified input time.

ToDateTime(TimeOnly)

Source:
DateOnly.cs
Source:
DateOnly.cs
Source:
DateOnly.cs

Returns a DateTime that is set to the date of this DateOnly instance and the time of specified input time.

C#
public DateTime ToDateTime(TimeOnly time);

Parameters

time
TimeOnly

The time of the day.

Returns

The DateTime instance composed of the date of the current DateOnly instance and the time specified by the input time.

Remarks

The Kind property of the resulting DateTime is initialized to DateTimeKind.Unspecified.

Applies to

.NET 10 та інші версії
Продукт Версії
.NET 6, 7, 8, 9, 10

ToDateTime(TimeOnly, DateTimeKind)

Source:
DateOnly.cs
Source:
DateOnly.cs
Source:
DateOnly.cs

Returns a DateTime instance with the specified input kind that is set to the date of this DateOnly instance and the time of specified input time.

C#
public DateTime ToDateTime(TimeOnly time, DateTimeKind kind);

Parameters

time
TimeOnly

The time of the day.

kind
DateTimeKind

One of the enumeration values that indicates whether ticks specifies a local time, Coordinated Universal Time (UTC), or neither.

Returns

The DateTime instance composed of the date of the current DateOnly instance and the time specified by the input time.

Applies to

.NET 10 та інші версії
Продукт Версії
.NET 6, 7, 8, 9, 10