toLocalTime

fun Calendar.toLocalTime(): LocalTime

Convert Calendar to LocalTime.

Since

1.1.0


fun Date.toLocalTime(): LocalTime

Convert Date to LocalTime.

Since

1.1.0


fun Instant.toLocalTime(timeZone: TimeZone = TimeZone.currentSystemDefault()): LocalTime

Convert Instant to LocalTime.

Since

1.1.0


fun LocalDateTime.toLocalTime(): LocalTime

Convert LocalDateTime to LocalTime.

Since

1.1.0


fun Long.toLocalTime(): LocalTime

Convert Long to LocalTime.

Example:

1_659_814_200_000.toLocalTime() // 00:00

Since

1.1.0


fun String.toLocalTime(pattern: String = "EEE MMM dd HH:mm:ss zzz yyyy"): LocalTime

Produce a LocalTime from the given strings value and pattern.

Example:

"21->15->0".toLocalTime("HH->mm->ss") // 21:15
"Sun Aug 07 16:37:42 IRDT 2022".toLocalTime() // 16:37:42
"21:10:00".toLocalTime("HH::mm") // ParseException

Since

1.1.0

Return

A LocalTime parsed from the string.

See also

Throws

if the beginning of the specified string cannot be parsed.

IllegalArgumentException

if the given pattern is invalid