Skip to main content

Python package to format duration

Project description

Downloads

format_duration

Python module to convert duration to human readable format

Installation

pip install format_duration

Usage

from datetime import timedelta
from format_duration import DurationLimit, format_duration

duration = timedelta(days=1, hours=1, minutes=1, seconds=1)  # duration to format
limit = DurationLimit.MINUTE  # only print till minutes
is_abbreviated = False  # Whether to print in abbreviated form
formatted_duration = format_duration(duration, is_abbreviated, limit)  # formatted duration string
print(formatted_duration)  # 1 days, 1 hours, 1 minutes 

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

format_duration-0.0.5.tar.gz (3.4 kB view hashes)

Uploaded Source

Built Distribution

format_duration-0.0.5-py3-none-any.whl (4.8 kB view hashes)

Uploaded Python 3

Supported by

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