A simple Python package for converting seconds to human-friendly duration strings.
Project description
uman-friendly-duration
Human-friendly-duration is a Python package that formats a duration, given as a number of seconds, in a human-friendly way. The package can be used to convert the duration of time into a combination of years, days, hours, minutes, and seconds. Installation
human-friendly-duration can be installed using pip:
sh
pip install human-friendly-duration
Usage
python
from humanfriendly_duration import format_duration
print(format_duration(62)) # output: 1 minute and 2 seconds print(format_duration(3662)) # output: 1 hour, 1 minute and 2 seconds
If the duration is zero, it will return "now".
python
print(format_duration(0)) # output: now
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for humanfriendlyduration-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc986523a67f1d5689ffc6d48ec75ccd07229910f9f6a8fc8f3c9dc47bccd5b1 |
|
MD5 | 79cd361fef56aec6b9e8bd7a1f5bd940 |
|
BLAKE2b-256 | b3e1711c9a527c1de977c0f5fefa0c5cb070f4891711f7c170069af00129c84b |