Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

humanfriendlyduration-1.0.0.tar.gz (1.7 kB view details)

Uploaded Source

File details

Details for the file humanfriendlyduration-1.0.0.tar.gz.

File metadata

  • Download URL: humanfriendlyduration-1.0.0.tar.gz
  • Upload date:
  • Size: 1.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for humanfriendlyduration-1.0.0.tar.gz
Algorithm Hash digest
SHA256 cc986523a67f1d5689ffc6d48ec75ccd07229910f9f6a8fc8f3c9dc47bccd5b1
MD5 79cd361fef56aec6b9e8bd7a1f5bd940
BLAKE2b-256 b3e1711c9a527c1de977c0f5fefa0c5cb070f4891711f7c170069af00129c84b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page