klyn.time.Duration.toString
method
public override toString() as String
Description

Returns a string representation of this Duration.

Supported placeholders: %h for hours, %m for minutes and %s for seconds. Fractional seconds are truncated. All finite Double values are supported, including durations whose seconds cannot be represented by Long. Negative durations use one minus sign before the first numeric component: Duration(seconds=-1).toString() returns -0 h 0 m 1 s. Durations truncated to zero have no sign.

Returns

A string representation of this Duration object.

Throws
  • ValueException if the duration is NaN or infinite.
Example
import klyn.time

duration = Duration(0, 0, 0, 3661)
print(duration.toString())  # 1 h 1 m 1 s