Skip to main content

dately

Deterministic date, time, timezone, holiday, and natural-language temporal processing for Python.

PyPI version Supported Python versions Downloads Powered by DOYDL Technologies

Overview

dately parses, detects, converts, replaces, and normalizes date and time values. It accepts individual strings as well as lists, dictionaries, NumPy arrays, and pandas Series. Its rule-based NLP engine also resolves expressions such as:

  • first Monday of next month
  • last 5 weekends
  • Q3 of last year
  • 3 days ago starting from April 10

The library includes Cython extensions for frequently used parsing operations and compatibility handling for platform-specific date-format behavior.

Installation

Install the latest published release from PyPI:

python -m pip install dately

To test a local checkout in an isolated environment:

python -m venv .venv-test
source .venv-test/Scripts/activate
python -m pip install --upgrade pip setuptools wheel
python -m pip install -e .
python -m pytest -q

Release downloads provide Windows x64 wheels for supported CPython versions and a source distribution. See Distribution builds for the artifact matrix and release procedure.

Quick start

import dately as dtly

dtly.detect_date_format("2024-03-13T14:30:00")
# '%Y-%m-%dT%H:%M:%S'

dtly.replace_datestring(
    "2024-03-13T14:30:00",
    year=2025,
    month=12,
    day=25,
)
# '2025-12-25T14:30:00'

dtly.replace_timestring(
    "2024-03-13 T14:30:00",
    hour=9,
    minute=15,
    tzinfo="Europe/London",
)
# '2024-03-13 T09:15:00 Europe/London'

dtly.parse("first Monday of next month")
# datetime.date(...) relative to the current date

Capabilities

Format detection and conversion

  • Detect common and custom date/time formats.
  • Convert values to a requested output format.
  • Extract individual year, month, day, time, and timezone components.
  • Process scalar values and nested collections.

Date and time replacement

  • Replace selected date or time components without rebuilding the input manually.
  • Preserve the original date/time separator where supported.
  • Work with ISO-8601 and non-ISO strings.

Natural-language parsing

  • Resolve relative, ordinal, anchored, and range expressions.
  • Interpret quarters, weeks, weekends, weekdays, months, and years.
  • Configure the first day of the week with set_week_start().
  • Return exact dates or date ranges through a deterministic rule-based pipeline.

Timezones and holidays

TimeZoner and Holidate are exposed as lazy-loaded public objects:

import dately as dtly

country_codes = dtly.TimeZoner.CountryCodes
zones = dtly.TimeZoner.Zones
holidays = dtly.Holidate

Bundled timezone and holiday properties work with local data. Operations that request current remote information still depend on their respective external services being available. See the issue and fix log for implementation details.

Cross-platform formatting

Windows and Unix-like platforms differ in their support for flags that suppress leading zeros in strftime directives. dately detects and normalizes these cases so formatting behavior remains consistent across supported platforms.

Examples

Runnable examples with expected output are available in the examples directory:

Documentation

License

dately is distributed under the MIT License. See LICENSE for details.

Metadata

Release files for dately 3.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for dately 3.3.2
File Actions
dately-3.3.2-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details for dately-3.3.2-cp314-cp314-win_amd64.whl
dately-3.3.2-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for dately-3.3.2-cp313-cp313-win_amd64.whl
dately-3.3.2-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for dately-3.3.2-cp312-cp312-win_amd64.whl
dately-3.3.2-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for dately-3.3.2-cp311-cp311-win_amd64.whl
dately-3.3.2-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details for dately-3.3.2-cp310-cp310-win_amd64.whl
dately-3.3.2-cp39-cp39-win_amd64.whl CPython 3.9 CPython 3.9 Windows x86-64 Details for dately-3.3.2-cp39-cp39-win_amd64.whl
dately-3.3.2-cp38-cp38-win_amd64.whl CPython 3.8 CPython 3.8 Windows x86-64 Details for dately-3.3.2-cp38-cp38-win_amd64.whl

Total release size: 2.9 MB

Release files / dately-3.3.2-cp314-cp314-win_amd64.whl

Download URL dately-3.3.2-cp314-cp314-win_amd64.whl
Size 422.5 kB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
23102280716574e418e30cee57f75f9c8eb64012b5603a49840a0c00b894ed43
BLAKE2b-256 checksum
How to use checksums
0f688fd720146d6f0e8856b1d9bef476b96bb262d2a5abd86ec32f0b922dabc1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.5

Release files / dately-3.3.2-cp313-cp313-win_amd64.whl

Download URL dately-3.3.2-cp313-cp313-win_amd64.whl
Size 415.7 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
703bcd9466c1a90f086bb80bfcdd340cbdd812db808d4deafb16eb68eeb063f5
BLAKE2b-256 checksum
How to use checksums
51713989c4fa57059e29b6e31f8c61ed5d80c208fd6cafde815948dd838157da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.5

Release files / dately-3.3.2-cp312-cp312-win_amd64.whl

Download URL dately-3.3.2-cp312-cp312-win_amd64.whl
Size 418.0 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
28869011c43908a9f694d8387cd7a0f0817433f6b7ef47ecf1ba0d72467591b6
BLAKE2b-256 checksum
How to use checksums
f25bc6866067c0229f3f26cef6ee3a8f1c8c574d6c298e8ea3b7c7e5790918e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.5

Release files / dately-3.3.2-cp311-cp311-win_amd64.whl

Download URL dately-3.3.2-cp311-cp311-win_amd64.whl
Size 417.4 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
9daf3d9d113f8485bb8dcf87b39a56e5bf2fc0e8d5a554d6a4fcffe6b8613a74
BLAKE2b-256 checksum
How to use checksums
3d6d678b26e3db7e756a7c9fb356ca06cb5edae3dc0d8f63314af25f22123998
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.5

Release files / dately-3.3.2-cp310-cp310-win_amd64.whl

Download URL dately-3.3.2-cp310-cp310-win_amd64.whl
Size 419.6 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
5c32184fd47d4ebfe2542303ccfabf7a8e7a1d1a75a138bd56cb90e1f5a73bcf
BLAKE2b-256 checksum
How to use checksums
0783cf0801f36a42b7e80065015f91edb3be9c1aa3efb7265f9b699d7a567989
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.5

Release files / dately-3.3.2-cp39-cp39-win_amd64.whl

Download URL dately-3.3.2-cp39-cp39-win_amd64.whl
Size 420.9 kB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
9004f9235b5b0d2f1c281abb703a541f3ad400c0020440f4da0d3340b456402e
BLAKE2b-256 checksum
How to use checksums
214312507e1403e1e218f14b01fe5f77bd420d78939eab7f7baae3b6d5f59d2c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.5

Release files / dately-3.3.2-cp38-cp38-win_amd64.whl

Download URL dately-3.3.2-cp38-cp38-win_amd64.whl
Size 424.0 kB
Tags CPython 3.8 Windows x86-64
SHA-256 checksum
How to use checksums
d5034ba53d90a25769b47c747042218c713f0e503a80b7d0ac1136a163791dc7
BLAKE2b-256 checksum
How to use checksums
3482d769ec5928d7396918e294ba4c894c514bc5bf5a97a9b0a9fc1e2bb63fb2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.5

Security for dately 3.3.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page