toString

actual open override fun toString(): String(source)
expect open override fun toString(): String(source)

Converts this time value to the extended ISO-8601 string representation.

For readability, if the time represents a round minute (without seconds or fractional seconds), the string representation will not include seconds. Also, fractions of seconds will add trailing zeros to the fractional part until the number of digits after the dot is a multiple of three.

Examples of output:

  • 18:43

  • 18:43:00

  • 18:43:00.500

  • 18:43:00.123456789

See also

for a very similar format. The difference is that Formats.ISO will always include seconds, even if they are zero, and will not add trailing zeros to the fractional part of the second for readability.

for the dual operation: obtaining LocalTime from a string.

for formatting using a custom format.

actual open override fun toString(): String(source)
actual open override fun toString(): String(source)