Date and Time in Python

5 projects in Python Language. Most starred: pendulum, dateparser and python-dateutil.

Since Python 3.9, the standard library's zoneinfo module provides IANA time zones, which removes the main reason to use pytz in new code. python-dateutil adds flexible parsing of date strings, relativedelta for calendar arithmetic such as adding a month, and recurrence rules. dateparser parses human-written dates, including relative expressions like "2 days ago", in many languages, which helps when scraping or reading user input.

Pendulum provides a datetime subclass that is time zone aware by default, with readable differences and durations. whenever takes a stricter approach: separate types for exact instants, zoned times and local times, so mistakes around daylight saving time become type errors rather than silent bugs; it has a Rust core with a pure Python fallback. Whatever library you use, store timestamps in UTC with time zone information and convert to local time only for display.

zoneinfoStandard library

IANA time zone support. Brings the tz database into Python.

python-dateutil

Extensions to the standard Python datetime module.

2.6kupdated 1d ago3.0.0

dateparser

A Python parser for human-readable dates in over 200 language locales.

2.9kupdated 1d ago1.4.3

pendulum

Python datetimes made easy.

6.7kupdated 12d ago3.3.0

whenever

A modern datetime library, type-safe and DST-safe, in Rust or pure Python.

2.4kupdated today0.11.0
Esc

Type to search every entry. ↑↓ to move, Enter to open.