ISO 8601 support
Project description
jetblack-iso8601
Support for ISO8601 (read the docs).
Usage
Timestamps
Timestamps can be parsed with iso8601_to_datetime
and
converted to a string with datetime_to_iso8601
.
from jetblack_iso8601 import (
iso8601_to_datetime,
datetime_to_iso8601
)
text = '2014-02-01T09:28:56.321-10:00'
timestamp = iso8601_to_datetime(text)
roundtrip = datetime_to_iso8601(timestamp)
assert text == roundtrip
Durations
Timestamps can be parsed with iso8601_to_timedelta
and
converted to a string with datetime_to_iso8601
.
from jetblack_iso8601 import (
iso8601_to_timedelta,
timedelta_to_iso8601
)
text = 'P3Y2M1DT12H11M10S'
value = iso8601_to_timedelta(text)
roundtrip = timedelta_to_iso8601(value)
assert roundtrip == text
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
Built Distribution
Close
Hashes for jetblack_iso8601-2.0.0a0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d401acb5598e55e3dab1428435eb6d7566f577a470b70e823ce1bd0456b0840f |
|
MD5 | 85eeeaaee49a0ccd900ea3c0264c9012 |
|
BLAKE2b-256 | 5db09b6cc87fef39e5df638fb4609b7ffe624ed87ed4ab3700fa34ff0eb4855d |