Learn to Code ยท zero-dependency ยท MIT

larztime

Human-friendly time.

'93784 seconds' means nothing to a person; '1 day, 2 hours, 3 minutes' does. larztime turns durations into readable words and back, formats clocks, and says things like '3 minutes ago' - all from plain numbers you pass in, so it's fully deterministic and testable.

larzscript pkg install time
View on GitHub →Learn the stack

What you get

Try it

import "time" as time
print(time.humanize(93784))
print(time.parse_duration("1h30m"))
print(time.ago(1000, 4600))
print(time.ago(1000, 500))
Output
1d 2h 3m 4s
5400
1 hour ago
in 8 minutes

Why it's in the Larz Stack

larztime is a real Larzscript package (larzscript pkg install time) - money-native, zero dependencies, the same language as the rest of the estate, not a separate Python runtime. It composes with the rest of the Larz Stack and the Larz framework.