Skip to main content

Date-offset

.. image:: https://badge.fury.io/py/date-offset.svg :target: http://badge.fury.io/py/date-offset

.. image:: https://codecov.io/gh/django-advance-utils/date-offset/branch/main/graph/badge.svg?token=QPGW5TIGX3 :target: https://codecov.io/gh/django-advance-utils/date-offset

This allow you to offset date / time with a string.

Example

.. code-block::

d = DateOffset()
tomorrow = d.get_offset("1d")
yesterday = d.get_offset("-1d")

Keyword

  • start of week (Monday)

  • * end of week
  • % first day of the month
  • d offset by days (1d)
  • w offset by weeks (1w)
  • m offset by months (1m)
  • y offset by years (1y)
  • ~ not weekend
  • s offset by seconds (3600s)
  • i offset by minutes (60m)
  • h offset by hours (1h)
  • t time (10t = 10hr. 10:15t = 10hr 15mins. 10:15:45t = 10hr 15mins 45secs)

Usage

If you want to include time in your output the include_time must be set.

.. code-block::

d = DateOffset()
one_hours_time = d.get_offset("1h", include_time=True)

Nested string can be used

.. code-block::

d = DateOffset()
second_day_of_current_month = d.get_offset("%1d")

Metadata

Release files for date-offset 0.0.3

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

Source distribution (sdist)

Source distribution for date-offset 0.0.3
File Size Uploaded Provenance
date-offset-0.0.3.tar.gz 4.9 kB Without provenance Details

Release files / date-offset-0.0.3.tar.gz

Download URL date-offset-0.0.3.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
e34743e8d52be5d26faae55b632b848ea0a56f4c68c8281dfc11e03922d48f87
BLAKE2b-256 checksum
How to use checksums
a2ee39ece7a1a96dfb7f780284c32ec7cff7d3ccc63dee22e68d6335b43bf97d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.6

Security for date-offset 0.0.3

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