Supplementary ISO8601 duration support for datetime.timedelta
Reason this release was yanked:
potential license violation
Project description
timedelta-iso8601
timedelta-iso8601
provides supplementary ISO8601 duration support for datetime.timedelta
.
The library contains a pure-Python implementation of ISO 8601 duration parsing that does not rely on regular expressions.
Functionality is provided in a subclass of datetime.timedelta
that implements additional isoformat()
and fromisoformat(duration_string)
methods.
Usage
>>> from timedelta_iso8601 import timedelta
>>> from datetime import datetime
>>>
>>> millenium = datetime(year=2000, month=1, day=1)
>>> now = datetime.utcnow()
>>>
>>> td = timedelta(seconds=(now - millenium).total_seconds())
>>> td.isoformat()
'P8310DT16H21M3S'
>>>
>>> millenium + timedelta.fromisoformat('P8310DT16H21M3S')
datetime.datetime(2022, 10, 2, 16, 21, 3)
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for timedelta_iso8601-0.1.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | deff5887cba4ca45bc06b0a43575388c6c998fce1a67057bacd2bdf1965f7458 |
|
MD5 | 297fb6b8af811826190c94c832b3637b |
|
BLAKE2b-256 | 54ff56fb2ee8e7e3dae1026db1d8d196d3ed453ebf2566d5146b670c4d7c7505 |