with

fun LocalTime.Companion.with(hours: Int = 0, minutes: Int = 0, seconds: Int = 0): LocalTime

Create a new time using specified hours, minutes, or seconds If you specify a value bigger than the initial, the remainder will spill into the next value. If you specify a value bigger than LocalTime.MAX, it will wrap around. Examples:

  • LocalTime.with(seconds=70) -> 00:01:10

  • LocalTime.with(hours=25, minutes=60) -> 02:00:00