Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

2
  • 6
    It's actually possible to do it like this: String.format("%02d:%02d:%02d",dur.toHoursPart(), dur.toMinutesPart(), dur.toSecondsPart());. The part methods give you the right numbers to build a string. I think it' more readable. Commented Mar 13, 2019 at 16:20
  • 1
    Side note to my previous comment: the part methods are only available from JDK 9 and up. Commented Mar 14, 2019 at 9:24