Skip to main content
Version: Java (Groovy)

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

ParameterTypeDescription
instantInstant

The Instant to convert.

timeZoneZoneId

The time zone.

dateTimeZonedDateTime

The zoned date-time to convert.

Returns

A LocalTime.

Examples

println toLocalTime(now(), timeZone("UTC"))