Skip to main content

Modern extension to the standard Python datetime module

Project description

[!NOTE] This package is rewrite of python-dateutil v2.9.0.post0 as base, to support active python versions only.
It is not related with the base project and its authors.
Docs of base project are under .base_project/

dateutilx - powerful extensions to datetime

Compatibility Py-Version
Quality Checks lint check tests pre-commit
Package pypi-v pypi-downloads
MetaData license-badge

The dateutilx module provides powerful extensions to the standard datetime module, available in Python.

Installation

dateutilx can be installed from PyPI using pip

pip install dateutilx

Download

dateutilx is available on PyPI https://pypi.org/project/dateutilx/

The documentation is hosted at: https://dateutilx.readthedocs.io/en/stable/

Code

The code and issue tracker are hosted on GitHub: https://github.com/rsb-23/dateutilx/

Features

  • Computing of relative deltas (next month, next year, next Monday, last week of month, etc);
  • Computing of relative deltas between two given date and/or datetime objects;
  • Computing of dates based on very flexible recurrence rules, using a superset of the iCalendar specification. Parsing of RFC strings is supported as well.
  • Generic parsing of dates in almost any string format;
  • Timezone (tzinfo) implementations for tzfile (5) format files (/etc/localtime, /usr/share/zoneinfo, etc), TZ environment string (in all known formats), iCalendar format files, given ranges (with help from relative deltas), local machine timezone, fixed offset timezone, UTC timezone, and Windows registry-based time zones.
  • Internal up-to-date world timezone information based on Olson's database.
  • Computing of Easter Sunday dates for any given year, using Western, Orthodox or Julian algorithms;
  • A comprehensive test suite.

Quick example

Here's a snapshot, just to give an idea about the power of the package. For more examples, look at the documentation.

Suppose you want to know how much time is left, in years/months/days/etc, before the next easter happening on a year with a Friday 13th in August, and you want to get today's date out of the "date" unix system command. Here is the code:

>>> from datetime import *
>>> from dateutilx.easter import *
>>> from dateutilx.parser import *
>>> from dateutilx.relativedelta import RelativeDelta
>>> from dateutilx.rrule import *
>>> 
>>> now = parse("Sat Oct 11 17:13:46 UTC 2003")
>>> today = now.date()
>>> year = rrule(YEARLY, dtstart=now, bymonth=8, bymonthday=13, byweekday=FR)[0].year
>>> rdelta = relativedelta(easter(year), today)
>>> print("Today is: %s" % today)
"Today is: 2003-10-11"
>>> print("Year with next Aug 13th on a Friday is: %s" % year)
"Year with next Aug 13th on a Friday is: 2004"
>>> print("How far is the Easter of that year: %s" % rdelta)
"How far is the Easter of that year: RelativeDelta(months=+6)"
>>> print("And the Easter of that year is: %s" % (today + rdelta))
"And the Easter of that year is: 2004-04-11"

Being exactly 6 months ahead was really a coincidence :)

Contributing

We welcome many types of contributions - bug reports, pull requests (code, infrastructure or documentation fixes). For more information about how to contribute to the project, see the CONTRIBUTING.md file in the repository.

Author

The dateutilx module is improved/re-written by rsb-23 in 2026.

License

All contributions after December 1, 2017 released under dual license - either Apache 2.0 License or the BSD 3-Clause License. Contributions before December 1, 2017 - except those those explicitly relicensed - are released only under the BSD 3-Clause License.

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

dateutilx-0.2.0.tar.gz (67.4 kB view details)

Uploaded Source

Built Distribution

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

dateutilx-0.2.0-py3-none-any.whl (75.1 kB view details)

Uploaded Python 3

File details

Details for the file dateutilx-0.2.0.tar.gz.

File metadata

  • Download URL: dateutilx-0.2.0.tar.gz
  • Upload date:
  • Size: 67.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for dateutilx-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e4b3d58a8378e96d992f221543510eee09a6cef52d8a20315ed92f287505563c
MD5 aff8f71c3b99858065c9f84432c952fc
BLAKE2b-256 85844df199d66d5f67886cf35e782374ceef9ef4d6f57c3201d2dd0f839662c4

See more details on using hashes here.

Provenance

The following attestation bundles were made for dateutilx-0.2.0.tar.gz:

Publisher: release.yml on rsb-23/dateutilx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dateutilx-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: dateutilx-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 75.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for dateutilx-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9650ce14e4ef30b8cdbdb961ae538d97091133351395896ceebc5161df7ecf24
MD5 6bb86fee92ec066140d93fdafa729158
BLAKE2b-256 565675619f02332387a8f740add3b6e1fcc8c035a6886d5f2e2c90418a27a619

See more details on using hashes here.

Provenance

The following attestation bundles were made for dateutilx-0.2.0-py3-none-any.whl:

Publisher: release.yml on rsb-23/dateutilx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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