Skip to content
FutureBlitz

    Install

    Import std.text.humanize

    FormatDuration

    std.text.humanize

    function

    Public Function FormatDuration(d: Duration): String

    d in words: each of its days, hours, minutes, and seconds that isn't 0, the seconds with their fraction, as "1 hour, 2 minutes, and 3.5 seconds" and "2 days and 1 minute". Under a second, it's in its largest unit: "250 milliseconds", "1.5 microseconds", and "80 nanoseconds". It's "0 seconds", and one before 0 is "minus" one after.

    Examples

    Expect(FormatDuration(90.Seconds) == "1 minute and 30 seconds")

    std/text/humanize.fb, line 307

    Report an issue with this page or with FutureBlitz on GitHub.