Skip to main content
License

Date Magic

datemagic module provides convenience function for operating with dates and time types.

Install the module the usual way using pip to start using it.

Example

Splitting year in 30-day chunks

>>> import datetime
>>> import datemagic
>>> datemagic.split_interval(datetime.date(2016,1,1),
...                          datetime.date(2016,12,31))
[(datetime.date(2016, 1, 1), datetime.date(2016, 1, 30)),
 (datetime.date(2016, 1, 31), datetime.date(2016, 2, 29)),
 (datetime.date(2016, 3, 1), datetime.date(2016, 3, 30)),
 (datetime.date(2016, 3, 31), datetime.date(2016, 4, 29)),
 (datetime.date(2016, 4, 30), datetime.date(2016, 5, 29)),
 (datetime.date(2016, 5, 30), datetime.date(2016, 6, 28)),
 (datetime.date(2016, 6, 29), datetime.date(2016, 7, 28)),
 (datetime.date(2016, 7, 29), datetime.date(2016, 8, 27)),
 (datetime.date(2016, 8, 28), datetime.date(2016, 9, 26)),
 (datetime.date(2016, 9, 27), datetime.date(2016, 10, 26)),
 (datetime.date(2016, 10, 27), datetime.date(2016, 11, 25)),
 (datetime.date(2016, 11, 26), datetime.date(2016, 12, 25)),
 (datetime.date(2016, 12, 26), datetime.date(2016, 12, 31))]

Default chunk size is 30 days.

For detailed description see the Python docstrings in the code.

Metadata

Release files for datemagic 0.1

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

Source distribution (sdist)

Source distribution for datemagic 0.1
File Size Uploaded
datemagic-0.1.tar.gz 447.3 kB Details

Release files / datemagic-0.1.tar.gz

Download URL datemagic-0.1.tar.gz
Size 447.3 kB
Tags Source
SHA-256 checksum
How to use checksums
52b0937657626c60746d514c04d7162c4a308300183f72ca14c1a22b95ad0ad7
BLAKE2b-256 checksum
How to use checksums
0590b857aa24bedc080372677db3b493df00facf2552e3feaf6ea1303b0cee95
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1 This release

1 release file

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