toLocalTime
The toLocalTime
method converts the supplied variables into a LocalTime.
A LocalTime is a Java object that represents a time, often viewed as hour-minute-second. A LocalTime can have up to nanosecond precision - for example, "10:15:30.123456789".
Syntax
toLocalTime(instant, timeZone)
toLocalTime(dateTime)
Parameters
Parameter | Type | Description |
---|---|---|
instant | Instant | The Instant to convert. |
timeZone | ZoneId | The time zone. |
dateTime | ZonedDateTime | The zoned date-time to convert. |
Returns
A LocalTime.
Examples
println toLocalTime(now(), timeZone("UTC"))
- Log