{ "info": { "author": "Felix", "author_email": "koffeinflummi@gmail.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4" ], "description": "A small Python 3 library containing some handy tools for handling time,\r\nespecially when it comes to interfacing with those pesky humans.\r\n\r\nFeatures\r\n--------\r\n\r\n- Parsing human-written strings (\"10 minutes ago\", \"10. April 2015\",\r\n \"2014-02-15\"...)\r\n- Relative time string creation (\"in 2 hours\", \"5 hours ago\")\r\n- Various input formats\r\n- Easy to use\r\n\r\nInstallation\r\n------------\r\n\r\n.. code:: bash\r\n\r\n $ pip install chronyk\r\n\r\nUsage\r\n-----\r\n\r\n**Basic:**\r\n\r\n.. code:: python\r\n\r\n >>> from chronyk import Chronyk\r\n >>> t = Chronyk(1410531179.0)\r\n >>> t = Chronyk(\"May 2nd, 2016 12:51 am\")\r\n >>> t = Chronyk(\"yesterday\")\r\n >>> t = Chronyk(\"21. 8. 1976 23:18\")\r\n >>> t = Chronyk(\"2 days and 30 hours ago\")\r\n >>> t.ctime()\r\n 'Tue Sep 9 05:59:39 2014'\r\n >>> t.timestamp()\r\n 1410235179.0\r\n >>> t.timestring()\r\n '2014-09-09 05:59:39'\r\n >>> t.timestring(\"%Y-%m-%d\")\r\n '2014-09-09'\r\n >>> t.relativestring()\r\n '3 days ago'\r\n >>> t.date()\r\n datetime.date(2014, 9, 9)\r\n >>> t.datetime()\r\n datetime.datetime(2014, 9, 9, 5, 59, 39)\r\n\r\n**Input validation:**\r\n\r\n.. code:: python\r\n\r\n import sys\r\n import chronyk\r\n\r\n timestr = input(\"Please enter the date you were born: \")\r\n try:\r\n date = chronyk.Chronyk(timestr, allowfuture=False)\r\n except chronyk.DateRangeError:\r\n print(\"Yeah, right.\")\r\n sys.exit(1)\r\n except ValueError:\r\n print(\"Failed to parse birthdate.\")\r\n sys.exit(1)\r\n else:\r\n print(\"You were born {}\".format(date.relativestring()))\r\n\r\n**Timezones:**\r\n\r\nBy default, the Chronyk constructor uses local time, and every method by\r\ndefault uses whatever was passed to the constructor as well.\r\n\r\nAlmost all methods, however, have a timezone keyargument that you can\r\nuse to define your local offset from UTC in seconds (positive for west,\r\nnegative for east).\r\n\r\nIf you want to use a certain timezone for more than one method, you can\r\nalso change the ``timezone`` instance attribute itself:\r\n\r\n.. code:: python\r\n\r\n >>> t = Chronyk(\"4 hours ago\", timezone=0) # using UTC\r\n >>> t.ctime()\r\n 'Tue Sep 9 10:53:42 2014'\r\n >>> t.timezone = -3600 # changes to CET (UTC+1)\r\n >>> t.relativeTime()\r\n '5 hours ago'\r\n >>> t.ctime()\r\n 'Tue Sep 9 09:53:42 2014'\r\n\r\nThis uses the local relative time and returns a time string relative to\r\ncurrent UTC:\r\n\r\n.. code:: python\r\n\r\n >>> t = Chronyk(\"4 hours ago\")\r\n >>> t.relativestring(timezone=0)\r\n '3 hours ago'\r\n\r\nThis uses a UTC timestamp and returns a time string relative to local\r\ntime:\r\n\r\n.. code:: python\r\n\r\n >>> t = Chronyk(1410524713.69, timezone=0)\r\n >>> t.relativestring(timezone=chronyk.LOCALTZ)\r\n '2 hours ago'", "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/KoffeinFlummi/Chronyk", "keywords": "time date clock human parser timezone", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "Chronyk", "package_url": "https://pypi.org/project/Chronyk/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/Chronyk/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/KoffeinFlummi/Chronyk" }, "release_url": "https://pypi.org/project/Chronyk/1.0.1/", "requires_dist": null, "requires_python": null, "summary": "A library for parsing human-written times and dates.", "version": "1.0.1" }, "last_serial": 1660755, "releases": { "0.9": [ { "comment_text": "", "digests": { "md5": "f7ab455514e707f214f8432980828944", "sha256": "817c31e069877a8ab3da65ecd6704a1c29de32cd95e7259448f297ce4990ee39" }, "downloads": -1, "filename": "Chronyk-0.9.tar.gz", "has_sig": false, "md5_digest": "f7ab455514e707f214f8432980828944", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5979, "upload_time": "2014-09-14T20:53:18", "url": "https://files.pythonhosted.org/packages/ef/24/7905579b0b2811ffe81840adaee7dce97462b74739a3924fa94f2101f193/Chronyk-0.9.tar.gz" } ], "0.9.1": [ { "comment_text": "", "digests": { "md5": "a8d6cebc7024a3f12b17f86c9fa8a5ee", "sha256": "a6d1fc6fbc3f741e4c0e8adc2dd7df51a07b2470fefdfe6b94641c89bd206849" }, "downloads": -1, "filename": "Chronyk-0.9.1.tar.gz", "has_sig": false, "md5_digest": "a8d6cebc7024a3f12b17f86c9fa8a5ee", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5987, "upload_time": "2014-09-14T21:10:15", "url": "https://files.pythonhosted.org/packages/7d/fa/8c64fc7772def40fc573958861646edb4c375f0ce160f2c0a20e88be3523/Chronyk-0.9.1.tar.gz" } ], "1.0": [ { "comment_text": "", "digests": { "md5": "b442130e988c2b2cc56d54d8b3fc87aa", "sha256": "39d57879ccef5242d2529a9b7cd2b75969ed1f9d0b205d192d72db894dee8344" }, "downloads": -1, "filename": "Chronyk-1.0.tar.gz", "has_sig": false, "md5_digest": "b442130e988c2b2cc56d54d8b3fc87aa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8235, "upload_time": "2015-08-02T14:42:58", "url": "https://files.pythonhosted.org/packages/ad/6a/13d6ffe7b1f2afc603980485395a998f6ff9ed131bd8ca6b6b744f65b780/Chronyk-1.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "92c66d8ce4bb548f7d17ad3dc8e1df20", "sha256": "6c4df94f410a608beaabc27dfa14e4b843a9aeb80e199bdee7b6bd0a88aac1a4" }, "downloads": -1, "filename": "Chronyk-1.0.1.tar.gz", "has_sig": false, "md5_digest": "92c66d8ce4bb548f7d17ad3dc8e1df20", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8243, "upload_time": "2015-08-02T14:48:20", "url": "https://files.pythonhosted.org/packages/87/7a/9b614bda8077fe6f772994f8ef1d11c603bec5f2aa22ebf483b4bd0675c7/Chronyk-1.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "92c66d8ce4bb548f7d17ad3dc8e1df20", "sha256": "6c4df94f410a608beaabc27dfa14e4b843a9aeb80e199bdee7b6bd0a88aac1a4" }, "downloads": -1, "filename": "Chronyk-1.0.1.tar.gz", "has_sig": false, "md5_digest": "92c66d8ce4bb548f7d17ad3dc8e1df20", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8243, "upload_time": "2015-08-02T14:48:20", "url": "https://files.pythonhosted.org/packages/87/7a/9b614bda8077fe6f772994f8ef1d11c603bec5f2aa22ebf483b4bd0675c7/Chronyk-1.0.1.tar.gz" } ] }