DateTimeRange
DateTimeRange is a Python library to handle a time range. e.g. check whether a time is within the time range, get the intersection of time ranges, truncate a time range, iterate through a time range, and so forth.
Decision gist · record as of 2026-08-14
Yes. DateTimeRange is actively maintained, has no known vulnerabilities, minimal dependencies, and solves a concrete problem in datetime handling that the standard library handles awkwardly. Install it if your code frequently reasons about time intervals, overlaps, or iteration across date ranges.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9 or later.
- Low install friction with just two runtime dependencies (python-dateutil and typepy).
- Actively maintained with a recent commit on 2026-07-20 and stable production status.
License · maintenance · safety
MIT License (permissive) — MIT License permits commercial and private use with minimal restrictions, making it suitable for most projects without licensing concerns.
last release 2025-11-14 (273 days) · last repo commit 2026-07-20 · 113 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 331,852 downloads/mo, #7,511 on PyPI
Alternatives
Verify before relying
pip install DateTimeRange
from datetimerange import DateTimeRange
time_range = DateTimeRange("2015-03-22T10:00:00+0900", "2015-03-22T10:10:00+0900")
print("2015-03-22T10:05:00+0900" in time_range)What it is and what it does
DateTimeRange is a Python library for creating and working with time intervals. It wraps datetime objects into range containers that support standard operations—checking whether a specific time falls within a range, finding overlaps between ranges, computing their union or intersection, and iterating through a range at regular intervals. The library handles timezone-aware datetimes and daylight saving time transitions.
You use it when you need to reason about time spans rather than individual moments: scheduling systems that check availability windows, log analysis that filters events within time bounds, or data pipelines that need to split time series into regular chunks. It depends on python-dateutil for relative date arithmetic and typepy for type validation.
Use it for
- Check if a specific timestamp falls within a scheduled maintenance window or business hours range.
- Find overlapping time slots when merging calendar events or meeting availability.
- Iterate through a date range in monthly or quarterly steps for reporting or data aggregation.
- Truncate or split time ranges to align with reporting periods or data collection windows.
- Compute the intersection of multiple time ranges to find common availability across resources.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
DateTimeRange is actively maintained, has no known vulnerabilities, minimal dependencies, and solves a concrete problem in datetime handling that the standard library handles awkwardly. Install it if your code frequently reasons about time intervals, overlaps, or iteration across date ranges.
Install
datetimerange on PyPI
Before you install
Low install friction with just two runtime dependencies (python-dateutil and typepy). Actively maintained with a recent commit on 2026-07-20 and stable production status.
Requires Python 3.9 or later.
License in practice
MIT License permits commercial and private use with minimal restrictions, making it suitable for most projects without licensing concerns.
Quickstart
pip install DateTimeRange
from datetimerange import DateTimeRange
time_range = DateTimeRange("2015-03-22T10:00:00+0900", "2015-03-22T10:10:00+0900")
print("2015-03-22T10:05:00+0900" in time_range)
Package facts
| License | MIT License permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagespython-dateutiltypepy |
| Maintenance | Actively maintained 273 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 331,852 / month, #7,511 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: Information TechnologyLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Topic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Python ModulesTopic :: Text ProcessingTyping :: Typed |
Evidence: datetimerange-2.3.2-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “time range operations”
- DateTimeRangeDateTimeRange creates and manipulates time range objects, supporting…
- dateutilsProvides date and time arithmetic operations, including range…
- intervaltreeA self-balancing interval tree data structure that stores and queries…
Give your agent the search over MCP, or paste the wish link into any chat.
More Libraries packages
urllib3 is an HTTP client library that provides thread-safe connection pooling, SSL/TLS verification, multipart file uploads, request retries, compression support, and proxy handling for Python applications.
Requests is a Python HTTP library that simplifies sending HTTP/1.1 requests with automatic handling of headers, authentication, cookies, and response parsing.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Provides parsing, arithmetic, and recurrence rule computation for dates and times, with timezone support and iCalendar RFC compliance.
Install it if you need to parse flexible date strings, compute relative dates, handle timezones, or work with recurrence rules—it's the de facto choice for these tasks.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
See also aniso8601 · types-DateTimeRange · dateformat · pendulum · whenever · pytz · scheduler · DateTime · croniter