Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

datemagic

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

datemagic

Convenience functions to work with dates

  • 0.1
  • PyPI
  • Socket score

Maintainers
1

.. image:: https://img.shields.io/aur/license/yaourt.svg :target: https://opensource.org/licenses/GPL-3.0 :alt: 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

.. code:: python

>>> 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.

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc