Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jetblack_iso8601-2.0.0.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jetblack_iso8601-2.0.0-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file jetblack_iso8601-2.0.0.tar.gz.

File metadata

  • Download URL: jetblack_iso8601-2.0.0.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.20

File hashes

Hashes for jetblack_iso8601-2.0.0.tar.gz
Algorithm Hash digest
SHA256 9360a726958941f4a0ed1c2c8e8d9da852c09b056adb1d7f7ca04aecd6d667f6
MD5 b7cdcee6526f68cc4f410cfcc7505b75
BLAKE2b-256 85d32be5be70859efb957ef53fff85023358771569139e64d74b4a3fb4de312f

See more details on using hashes here.

File details

Details for the file jetblack_iso8601-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for jetblack_iso8601-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b0dd331f24f96e35235c47dd604f97a74e86204f47517f21c07045f062921d41
MD5 9fb4684856672d6b5a3a1b65cf5056bf
BLAKE2b-256 d50b464c78ebd889ca921ea0591cbbc66a6e1dc62dc03a02b6d5f3487d5d47f4

See more details on using hashes here.

Supported by

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