{ "info": { "author": "Raphael Amoedo", "author_email": "avalon.ralph@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "# Easy_Date #\n\n* https://github.com/ralphavalon/easy_date\n\n* https://pypi.python.org/pypi/easy-date\n\nLet's face it: there's no JodaTime for Python, and dealing with date, datetime, timestamp in Python it's not very readable or easy to understand. Easy_date can convert between str, date, datetime and timestamp easily for you and it is readable.\n\n### Example - String to String ###\n\n```\nimport easy_date\n\nstr_date = '25/12/2014' #%d/%m/%Y\nnew_str_date = easy_date.convert_from_string(str_date, '%d/%m/%Y', '%m-%d-%Y') # str is default return type\n```\n\n**new_str_date** will be **12-25-2014**.\n\n### Installation ###\n\nInstall the latest stable release with:\n\n``pip install easy_date``\n\nor \n\n``easy_install -U easy_date``\n\nThere are no hard dependencies other than the Python standard library.\nIt works with Python **2.6+** and **3.x**, but it wasn't tested on previous versions.\n\n\n### How do I convert dates? ###\n\n#### Can use two ways:\n \n* Using **easy_date**\n\n```\nfrom datetime import date, datetime\nimport easy_date\n\nstr_date = '25/12/2014' #%d/%m/%Y\n\n#convert_from_string(string, current_format, to_format, to_type)\n\nnew_str_date = easy_date.convert_from_string(str_date, '%d/%m/%Y', '%m-%d-%Y') # str is default return type\n\ndate_time = easy_date.convert_from_string(str_date, '%d/%m/%Y', '%Y-%m-%d', datetime)\n\ntimestamp = easy_date.convert_from_string(str_date, '%d/%m/%Y', None, float) # e.g. 1419472800.0\n\nmy_date = easy_date.convert_from_string(str_date, '%d/%m/%Y', None, date)\n\n```\n\n \n* Using **date_converter**\n\n```\nfrom datetime import date, datetime\nimport date_converter\n\nstr_date = '25/12/2014' #%d/%m/%Y\n\n#string_to_string(string, current_format, to_format)\nnew_str_date = date_converter.string_to_string(str_date, '%d/%m/%Y', '%m-%d-%Y')\n\n#string_to_datetime(string, current_format, to_format)\ndate_time = date_converter.string_to_datetime(str_date, '%d/%m/%Y', '%Y-%m-%d')\n\n#string_to_timestamp(string, current_format)\ntimestamp = date_converter.string_to_timestamp(str_date, '%d/%m/%Y')\n\n#string_to_date(string, current_format)\nmy_date = date_converter.string_to_date(str_date, '%d/%m/%Y')\n\n```\n\n### Available methods ###\n\n* from **easy_date**\n\n\n```\n#Acceptable types: (str, datetime.datetime, datetime.date, float)\nconvert_from_string(string, current_format, to_format, to_type=str)\n\n#Acceptable types: (str, datetime.datetime, datetime.date, float)\nconvert_from_datetime(from_datetime, to_format, to_type=str)\n\n#Acceptable types: (str, datetime.datetime, float)\nconvert_from_date(from_date, to_format, to_type=str)\n\n#Acceptable types: (str, datetime.datetime, datetime.date)\nconvert_from_timestamp(timestamp, to_format, to_type=str)\n\n```\n\n\n* from **date_converter**\n\n```\n#from datetime.date\ndate_to_datetime(from_date)\ndate_to_string(from_date, to_format)\ndate_to_timestamp(from_date)\n\n#from datetime.datetime\ndatetime_to_date(from_datetime)\ndatetime_to_datetime(from_datetime, to_format)\ndatetime_to_string(from_datetime, to_format)\ndatetime_to_timestamp(from_datetime)\n\n#from str\nstring_to_date(string, current_format)\nstring_to_datetime(string, current_format, to_format=None)\nstring_to_string(string, current_format, to_format)\nstring_to_timestamp(string, current_format)\n\n#from float\ntimestamp_to_date(timestamp)\ntimestamp_to_datetime(timestamp, to_format=None)\ntimestamp_to_string(timestamp, to_format)\n\n```\n\n### Development ###\n\n* All tests were executed using Brazil (America/Sao_Paulo) timezone. So, if you're not on this timezone and want to run tests, you can do:\n\n```\nsudo ln -fs /usr/share/zoneinfo/America/Sao_Paulo /etc/localtime\n```\n\n* You can back to your timezone using the same way.\n* You can take a look on **travis_setup.sh**.\n\n### Contribution guidelines ###\n\n* Every help or suggestion is welcome.\n\n### License ###\n\n* Code and documentation are available according to the MIT License (see LICENSE.md).\n", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://pypi.python.org/pypi/easy-date/", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "easy-date", "package_url": "https://pypi.org/project/easy-date/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/easy-date/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://pypi.python.org/pypi/easy-date/" }, "release_url": "https://pypi.org/project/easy-date/0.1.4/", "requires_dist": null, "requires_python": null, "summary": "Easy and readable way to convert dates.", "version": "0.1.4" }, "last_serial": 1540644, "releases": { "0.1.0": [], "0.1.1": [ { "comment_text": "", "digests": { "md5": "74fceffd91fd44fbc8e0ef27b634f3e3", "sha256": "94cdeca53a0bdc446c927c24d01ed9a9d82c4a17df2791381d1eaf447faf8ac5" }, "downloads": -1, "filename": "easy-date-0.1.1.tar.gz", "has_sig": false, "md5_digest": "74fceffd91fd44fbc8e0ef27b634f3e3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3046, "upload_time": "2015-05-09T18:25:01", "url": "https://files.pythonhosted.org/packages/e5/43/a97e36aafb89919ebb863c2d27a158f63537509d962a4a9d897c9305d769/easy-date-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "22c0bbcb64d58b75017158e70d709022", "sha256": "27227c21cf65cbd03ff8467a45e9c220db67ee6b5ccc5150cb5955039f666983" }, "downloads": -1, "filename": "easy-date-0.1.2.tar.gz", "has_sig": false, "md5_digest": "22c0bbcb64d58b75017158e70d709022", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3058, "upload_time": "2015-05-09T18:33:34", "url": "https://files.pythonhosted.org/packages/8e/c5/4b52532481a741934cdb702b1ebbcfe29eab69d959d7bda05ea9ad738222/easy-date-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "a483450c57ccdb37815ed9c506c9f651", "sha256": "993430b4caa82e1ab655ab738239108a8c7cad098331a1bf9dac47e56366a515" }, "downloads": -1, "filename": "easy-date-0.1.3.tar.gz", "has_sig": false, "md5_digest": "a483450c57ccdb37815ed9c506c9f651", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2995, "upload_time": "2015-05-09T19:04:11", "url": "https://files.pythonhosted.org/packages/1d/32/556f169471d261207e331f6a95a7b44ab093eb2cb20e424e927a18149bba/easy-date-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "007aa2ce2dfdeccc6b57c6fa6c70607e", "sha256": "7d77c78317d35e5775625ced2da26958474516fa703c134ae32f988aa8fac688" }, "downloads": -1, "filename": "easy-date-0.1.4.tar.gz", "has_sig": false, "md5_digest": "007aa2ce2dfdeccc6b57c6fa6c70607e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3041, "upload_time": "2015-05-10T06:20:14", "url": "https://files.pythonhosted.org/packages/f6/48/af564a057ca1eba7e6e6744d6d9f4876798e12d7ed5de5b8b0124147206c/easy-date-0.1.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "007aa2ce2dfdeccc6b57c6fa6c70607e", "sha256": "7d77c78317d35e5775625ced2da26958474516fa703c134ae32f988aa8fac688" }, "downloads": -1, "filename": "easy-date-0.1.4.tar.gz", "has_sig": false, "md5_digest": "007aa2ce2dfdeccc6b57c6fa6c70607e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3041, "upload_time": "2015-05-10T06:20:14", "url": "https://files.pythonhosted.org/packages/f6/48/af564a057ca1eba7e6e6744d6d9f4876798e12d7ed5de5b8b0124147206c/easy-date-0.1.4.tar.gz" } ] }