nr-date

2.1.0 · active · verified Thu Apr 16

nr-date is a fast, regex-based Python library designed for parsing human-readable dates and ISO 8601 durations in pure Python. It provides functionality to handle various date and time formats and is known for its performance compared to some standard library alternatives. The library is currently at version 2.1.0 and receives periodic updates, with major releases occurring roughly every few years.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates parsing an ISO 8601 datetime string and an ISO 8601 duration string using the respective parsers from `nr.parsing.date`.

from nr.parsing.date import ISO_8601, duration

# Parse an ISO 8601 datetime string
datetime_obj = ISO_8601.parse('2021-04-21T10:13:00.124+0000')
print(f"Parsed datetime: {datetime_obj}")

# Parse an ISO 8601 duration string
duration_obj = duration.parse('P3Y6M4DT12H30M5S')
print(f"Parsed duration: {duration_obj}")

view raw JSON →