Skip to main content

Wrapper object around relativedelta to manage date and datetime strings

Project description

DateStr Package

DateStr package provide a wrapper object around relativedelta to manage date and datetime strings

Installation :

pip install datestr

Examples :

Example 1:

>>> from datestr import Date
>>> Date('2017-06-04').relativedelta(days=2)
>>> type(Date('2017-06-04').relativedelta(days=2))
<class 'str'>

Example 2:

>>> from datestr import Date
>>> Date('2017-06-04').relativedelta(month=2, day=3)
>>> Date('2017-06-04').relativedelta(last_day=True)
>>> Date('2017-06-04').relativedelta(months=4, last_day=True)

Example 3:

>>> from datestr import Date
>>> Date('2017-06-04').relativedelta(hour=12)
>>> '2017-06-04'
>>> Date('2017-06-04').relativedelta(hour=12, rtype='datetime')
>>> '2017-06-04 12:00:00'

Example 4:

>>> from datestr import Date
>>> Date('2017-06-04 04:30:00').relativedelta(days=4, hour=12)
>>> '2017-06-08 12:30:00'
>>> Date('2017-06-04 04:30:00').relativedelta(days=4, hour=12, rtype='date')
>>> '2017-06-08'

Example 5:

>>> from datestr import Date
>>> from datetime import datetime, date
>>> Date(date(2018, 6, 3)).relativedelta()
>>> '2018-06-03'
>>> Date(datetime(2018, 6, 3, 12, 15, 30)).relativedelta()
>>> '2018-06-03 12:15:30'


This software is made available under the LGPL v3 license.

Bug Tracker

Please, feel free to report bugs or suggestions in the Bug Tracker!


Mohamed Cherkaoui <>



Release date: 04-Jun-2017

  • First stable version

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for datestr, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size datestr-0.1.0.tar.gz (2.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page