Method FromDateTime
FromDateTime(DateTime)
Converts System.DateTime to TimeOnly. Date component is dropped in the conversion, and time component is truncated to the nearest second.
Declaration
public static TimeOnly FromDateTime(DateTime dateTime)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | dateTime | The DateTime to convert. |
Returns
Type | Description |
---|---|
TimeOnly | A new instance of TimeOnly. |
Applies to
Platforms and versions
Target | Versions |
---|---|
.NET Framework | 200.4 - 200.5 |
UWP | 200.4 - 200.5 |