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
File details
Details for the file jetblack-iso8601-1.0.2.tar.gz
.
File metadata
- Download URL: jetblack-iso8601-1.0.2.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.12 CPython/3.9.13 Darwin/21.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 919e3703163254f2195f2132088dac0b77b637629ae597cf20c1eb70b0d727e6 |
|
MD5 | 69f72cb887e25506109238af821b3eec |
|
BLAKE2b-256 | 601956810f6dc939c4a755d9c0b2047a3ddd40d3c1e78856e86958529c4dfef2 |
File details
Details for the file jetblack_iso8601-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: jetblack_iso8601-1.0.2-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.12 CPython/3.9.13 Darwin/21.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c5f71593f9b9f8f900ccd17a63b535fb17186ffc6d72f8249cb292e63c8fbd2f |
|
MD5 | c0e8633050e7f3b084575d1fbbcf3b3c |
|
BLAKE2b-256 | d931ac64c721b61f21b7acc351f302b3d17456fb4e8f70e20fdc50112be681c8 |