{ "info": { "author": "Bj\u00f6rn Andersson", "author_email": "ba@sanitarium.se", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Programming Language :: Python" ], "description": "================\r\ndatetime_periods\r\n================\r\n\r\n.. image:: https://travis-ci.org/gaqzi/datetime_periods.png\r\n :target: https://travis-ci.org/gaqzi/datetime_periods\r\n\r\nThis module aims to help you create time periods from timestamps.\r\n\r\nPass in a ``datetime.datetime()`` object and a period name and it'll\r\nreturn the beginning and end of that period.\r\n\r\nDocumentation available on `Read the Docs`_.\r\n\r\nInstallation:\r\n-------------\r\n\r\nYou can install from PyPi!\r\n\r\n.. code-block::\r\n\r\n pip install datetime_periods\r\n\r\n\r\n``period`` usage\r\n----------------\r\n\r\nPass in a ``datetime.datetime()`` object and a period name and it'll\r\nreturn the beginning and end of that period.\r\n\r\n.. code-block::\r\n\r\n >>> from datetime_periods import period\r\n >>> period(datetime(2012, 4, 2, second=12), 'minute')\r\n [datetime(2012, 4, 2), datetime(2012, 4, 2, 0, 0, 59)]\r\n >>> period(datetime(2012, 4, 2), 'hour')\r\n [datetime(2012, 4, 2, 0), datetime(2012, 4, 2, 0, 59, 59)]\r\n >>> period(datetime(2012, 4, 2), 'day')\r\n [datetime(2012, 4, 2), datetime(2012, 4, 2, 23, 59, 59)]\r\n >>> period(datetime(2012, 4, 2), 'week')\r\n [datetime(2012, 4, 2), datetime(2012, 4, 8, 23, 59, 59)]\r\n >>> period(datetime(2012, 4, 15), 'month')\r\n [datetime(2012, 4, 1), datetime(2012, 4, 30, 23, 59, 59)]\r\n >>> period(datetime(2012, 4, 2), 'quarter')\r\n [datetime(2012, 4, 1), datetime(2012, 6, 30, 23, 59, 59)]\r\n >>> period(datetime(2012, 9, 1), 'half_year')\r\n [datetime(2012, 7, 1), datetime(2012, 12, 31, 23, 59, 59)]\r\n >>> period(datetime(2012, 7, 1), 'year')\r\n [datetime(2012, 1, 1), datetime(2012, 12, 31, 23, 59, 59)]\r\n\r\n\r\n``TimeRange`` usage\r\n-------------------\r\n\r\nThe ``TimeRange`` class takes two times, ``start`` and ``stop``, and creates\r\n``datetime`` objects from them that is smart about when a date should\r\nroll over to the following day.\r\n\r\nThis class can also act like a 2 length list where index 0=start,\r\n1=stop time. This to allow the class to be used for argument\r\nexpansion and as an iterator.\r\n\r\n.. code-block::\r\n\r\n >>> from datetime_periods import TimeRange\r\n >>> tr = TimeRange('17:00', '23:00', '2013-12-25')\r\n >>> tr.start\r\n datetime(2013, 12, 25, 17)\r\n >>> tr.stop\r\n datetime(2013, 12, 25, 23)\r\n >>> tr = TimeRange('17:00', '04:00', '2013-12-25')\r\n >>> tr.start\r\n datetime(2013, 12, 25, 17)\r\n >>> tr.stop\r\n datetime(2013, 12, 26, 4)\r\n >>> tr[0] == tr.start\r\n True\r\n >>> tr[1] == tr.stop\r\n True\r\n\r\nSugar\r\n-----\r\n\r\nThe ``sugar`` module has sugar functions for all variants available.\r\n\r\nSugar functions for entire period:\r\n\r\n* ``period_second``\r\n* ``period_minute``\r\n* ``period_hour``\r\n* ``period_day``\r\n* ``period_week``\r\n* ``period_month``\r\n* ``period_quarter``\r\n* ``period_half_year``\r\n* ``period_year``\r\n\r\nSugar functions for beginning of period:\r\n\r\n* ``period_beginning_second``\r\n* ``period_beginning_minute``\r\n* ``period_beginning_hour``\r\n* ``period_beginning_day``\r\n* ``period_beginning_week``\r\n* ``period_beginning_month``\r\n* ``period_beginning_quarter``\r\n* ``period_beginning_half_year``\r\n* ``period_beginning_year``\r\n\r\nSugar functions for end of period:\r\n\r\n* ``period_end_second``\r\n* ``period_end_minute``\r\n* ``period_end_hour``\r\n* ``period_end_day``\r\n* ``period_end_week``\r\n* ``period_end_month``\r\n* ``period_end_quarter``\r\n* ``period_end_half_year``\r\n* ``period_end_year``\r\n\r\n.. _Read the Docs: http://datetime_periods.readthedocs.org/en/latest/", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/gaqzi/datetime_periods", "keywords": "", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "datetime_periods", "package_url": "https://pypi.org/project/datetime_periods/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/datetime_periods/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/gaqzi/datetime_periods" }, "release_url": "https://pypi.org/project/datetime_periods/1.1.1/", "requires_dist": null, "requires_python": null, "summary": "Easily create time periods from timestamps", "version": "1.1.1" }, "last_serial": 1055131, "releases": { "1.1.0": [ { "comment_text": "", "digests": { "md5": "16a2738971beaf207d2aa9ea805dc0fd", "sha256": "9fb2480eb27333e62da0fdfe4061736fecc8a91d5b767359c72a9a5a0d4256fa" }, "downloads": -1, "filename": "datetime_periods-1.1.0.tar.gz", "has_sig": false, "md5_digest": "16a2738971beaf207d2aa9ea805dc0fd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4941, "upload_time": "2013-12-28T05:54:20", "url": "https://files.pythonhosted.org/packages/f9/01/125447891ab6e0b571965003fa987916d9100f9c8607048701e907885a41/datetime_periods-1.1.0.tar.gz" } ], "1.1.1": [ { "comment_text": "", "digests": { "md5": "7a2840ab6122c1d4cdc9db16c3cada71", "sha256": "4e22beb8ea176f398cddd5f18520a907ff85cb161690f81c8c9d7839fcfbdf0e" }, "downloads": -1, "filename": "datetime_periods-1.1.1.tar.gz", "has_sig": false, "md5_digest": "7a2840ab6122c1d4cdc9db16c3cada71", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5004, "upload_time": "2013-12-28T06:51:52", "url": "https://files.pythonhosted.org/packages/a3/2e/873f967d231b74a0a2b88b4f0fd1d1e8d294e16c44790ccb7de412f75528/datetime_periods-1.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7a2840ab6122c1d4cdc9db16c3cada71", "sha256": "4e22beb8ea176f398cddd5f18520a907ff85cb161690f81c8c9d7839fcfbdf0e" }, "downloads": -1, "filename": "datetime_periods-1.1.1.tar.gz", "has_sig": false, "md5_digest": "7a2840ab6122c1d4cdc9db16c3cada71", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5004, "upload_time": "2013-12-28T06:51:52", "url": "https://files.pythonhosted.org/packages/a3/2e/873f967d231b74a0a2b88b4f0fd1d1e8d294e16c44790ccb7de412f75528/datetime_periods-1.1.1.tar.gz" } ] }