Skip to main content

timedeltafmt

A tool to parse and format timedelta

Examples

from datetime import timedelta

from timedeltafmt import parse_timedelta, format_timedelta, make_formatter, MICROSECOND, SECOND

print(parse_timedelta('1day 24h'))  # 2 days, 0:00:00
print(parse_timedelta('10s 1m 1s'))  # 0:01:11

print(format_timedelta(timedelta(weeks=1)))  # 7d
print(format_timedelta(timedelta(days=365.25)))  # 1y

JIFFY_FMT = make_formatter({
    MICROSECOND: 'ms',
    SECOND // 50: 'jiffies',
})

print(JIFFY_FMT.format(timedelta(seconds=2)))  # 100jiffies

Release files for timedeltafmt 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for timedeltafmt 0.1.1
File Size Uploaded
timedeltafmt-0.1.1.tar.gz 4.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for timedeltafmt 0.1.1
File Interpreter ABI Platform
timedeltafmt-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 10.1 kB

Release files / timedeltafmt-0.1.1.tar.gz

Download URL timedeltafmt-0.1.1.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
cf475f1969d3c4ee722671319e4c548bc556de5512da505facc5953ec6d54a17
BLAKE2b-256 checksum
How to use checksums
cd669c5c2130149b763b82c1713f0264becde979353dad055a4cb2782311afcc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

Release files / timedeltafmt-0.1.1-py3-none-any.whl

Download URL timedeltafmt-0.1.1-py3-none-any.whl
Size 5.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
28ce0fce44748fe3c4db301c078ecc6583367540f6f5e4c41c20e64109cd7fc8
BLAKE2b-256 checksum
How to use checksums
6a9611aac8a167950dd9a24a53366ea3c64f54e4d38cb80ebc35ee4f8fed3b37
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page