{ "info": { "author": "Amit Garu", "author_email": "amitgaru2@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "# Nepali Date (Bikram Sambat B.S) API \n\nThe API similar to datetime.date() that works on the BS date instead of AD.\n**Now with NEPALI language support for date display.**\n\n### Installation\n---\n \nYou can install the Nepali Date from PyPI: ```pip install nepali-date```\n\n\n### Usage\n---\n\n**B.S Date today**\n```python\nfrom nepali_date import NepaliDate\n\nprint(NepaliDate.today())\nprint(NepaliDate.today(lang='nep')) # for date in nepali language format\n```\n\n**Creating NepaliDate object (instance)**\n```python\nfrom nepali_date import NepaliDate\n \nnew_year_2050 = NepaliDate(2050, 1, 1)\nnew_year_2051 = NepaliDate('2051', '1', '1')\n\nprint(new_year_2050, new_year_2051)\n\n# for date in nepali language\nnew_year_2052 = NepaliDate(2052, 1, 1, lang='nep')\nnew_year_2053 = NepaliDate('2053', '1', '1', lang='nep')\n\nprint(new_year_2052, new_year_2053)\n```\n**Adding/Subtracting datetime.timedelta to NepaliDate instance**\n```python \nimport datetime\n\nfrom nepali_date import NepaliDate\n\nnew_year_2051 = NepaliDate(2051, 1, 1)\nhundred_days_after_new_year_2051 = new_year_2051 + datetime.timedelta(days=100)\nhundred_days_before_new_year_2051 = new_year_2051 - datetime.timedelta(days=100)\n```\n**Converting datetime.date to NepaliDate or vice-versa**\n```python\nimport datetime\n\nfrom nepali_date import NepaliDate\n\nmy_birthday_in_ad = datetime.date(1995, 10, 15)\nmy_birthday_in_bs = NepaliDate.to_nepali_date(my_birthday_in_ad)\n\nmy_birthday = NepaliDate(2051, 10, 1)\nmy_birthday_in_ad = my_birthday.to_english_date()\n```\n### Monthly Calendar\n---\n**Current nepali month calendar highlighting today's date**\n```python\nfrom nepali_date import NepaliDate\nNepaliDate.calendar()\n```\n![Screenshot](https://raw.githubusercontent.com/arneec/nepali-date/master/screenshots/nepali_monthly_calendar.PNG)\n\nJustify the output by providing keyword argument ```justify```\n```python\nNepaliDate.calendar(justify=50)\n```\n\nDisplay the calendar in nepali language format by providing keyword argument ```lang```\n```python\nNepaliDate.calendar(lang='nep')\n```\n\n\n### Date in iso-format ie. 'YYYY-MM-DD'\n---\n```python\ndt = NepaliDate(2076, 4, 2)\nprint(dt.isoformat())\n\ndt_nep = NepaliDate(2076, 6, 24, lang='nep')\nprint(dt_nep.isoformat()) # \u0968\u0966\u096d\u096c-\u0966\u096c-\u0968\u096a\n```\n\n### Date display formatting\n---\n\nFormat Specifier | Meaning | lang='eng' *(default)* | lang='nep'\n--- | --- | --- | ---\n```%d``` | Day of the month as a zero-padded decimal number. | ```01```, ```02```, ..., ```32``` | ```\u0966\u0967```, ```\u0966\u0968```, ..., ```\u0969\u0968```\n```%b``` | Month as abbreviated name. | ```Bai```, ```Jes```, ..., ```Cha``` | ```\u092c\u0948\u0936\u093e\u0916```, ```\u091c\u0947\u0937\u094d\u0920```, ..., ```\u091a\u0948\u0924\u094d\u0930```\n```%B``` | Month as full name. | ```Baishak```, ```Jestha```, ..., ```Chait``` | ```\u092c\u0948\u0936\u093e\u0916```, ```\u091c\u0947\u0937\u094d\u0920```, ..., ```\u091a\u0948\u0924\u094d\u0930```\n```%m``` | Month as a zero-padded decimal number. | ```01```, ```02```, ..., ```12``` | ```\u0966\u0967```, ```\u0966\u0968```, ..., ```\u0967\u0968```\n```%y``` | Year without century as a zero-padded decimal number. | ```00```, ```01```, ..., ```99``` | ```\u0966\u0966```, ```\u0966\u0967```, ..., ```\u096f\u096f```\n```%Y``` | Year with century as a decimal number. | ```1975```, ```1976```, ..., ```2075```, ```2076```, ```2077```, ```2078```, ..., ```2100``` | ```\u0967\u096f\u096d\u096b```, ```\u0967\u096f\u096d\u096c```, ..., ```\u0968\u0966\u096d\u096b```, ```\u0968\u0966\u096d\u096c```, ```\u0968\u0966\u096d\u096d```, ```\u0968\u0966\u096d\u096e```, ..., ```\u0968\u0967\u0966\u0966```\n\nFormat specifier for ```lang='eng'```\n```python\ndt = NepaliDate(2076, 4, 7)\nprint(\"{0:B} {0:d}\".format(dt))\n```\n\nFormat specifier for ```lang='nep'```\n```python\ndt = NepaliDate(2076, 4, 7, lang='nep')\nprint(\"{0:B} {0:d}\".format(dt))\n```\n\n### strfdate\n---\nSimilar API to ```datetime.datetime.strftime```. NepaliDate to formatted string. Follow the formatting table to know the formatting string.\n```python\ndt = NepaliDate(2075, 10, 10)\nprint(dt.strfdate('%Y/%m/%d'))\n\ndt_nep = NepaliDate(2076, 6, 24)\nprint(dt_nep.strfdate('%Y/%m/%d')) # \u0968\u0966\u096d\u096c/\u0966\u096c/\u0968\u096a\n```\n\n### strpdate\n---\nSimilar API to ```datetime.datetime.strptime```. Return NepaliDate instance if string and format matches. Follow the formatting table to know the formatting string.\n```python\nnepali_date = NepaliDate.strpdate('06/20/2076', '%m/%d/%Y')\nprint(nepali_date, type(nepali_date))\n```", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/arneec/nepali-date", "keywords": "Nepali,BS,B.S,Date,Nepal,Bikram,Sambat,Year,Month,Day", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "nepali-date", "package_url": "https://pypi.org/project/nepali-date/", "platform": "", "project_url": "https://pypi.org/project/nepali-date/", "project_urls": { "Homepage": "https://github.com/arneec/nepali-date" }, "release_url": "https://pypi.org/project/nepali-date/2.0.2/", "requires_dist": null, "requires_python": "", "summary": "Nepali Date API", "version": "2.0.2" }, "last_serial": 5974366, "releases": { "1.0.2": [ { "comment_text": "", "digests": { "md5": "d6ec0655b469733b046df20fb156e5ce", "sha256": "64eda84de16f9217ae05a41dcb8617e18895db2bfd92c9c3e6fdf5f271d86d44" }, "downloads": -1, "filename": "nepali_date-1.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "d6ec0655b469733b046df20fb156e5ce", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5441, "upload_time": "2019-01-07T14:33:59", "url": "https://files.pythonhosted.org/packages/6d/4e/25697644c47b99ca266f10edec481bd66422efcfe9db4885bbe413a21379/nepali_date-1.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d1fa39750af769904f54b639d81bfdb2", "sha256": "9d47d4a5870d16e7ff22d864ff5495621ac82570e399646a417b785c0c6df4ff" }, "downloads": -1, "filename": "nepali-date-1.0.2.tar.gz", "has_sig": false, "md5_digest": "d1fa39750af769904f54b639d81bfdb2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5300, "upload_time": "2019-01-07T14:34:00", "url": "https://files.pythonhosted.org/packages/45/66/606fa30a10d8a78e0bb32272f28229ba9f061bc05b8a06c3e5cfc6b6cba3/nepali-date-1.0.2.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "b051ad4cdce84a1de4b1d6ddc01d760d", "sha256": "20856b885ecaad4e554141ef1af850ec68bc835e86aa0d48e7d80ccea1943f8e" }, "downloads": -1, "filename": "nepali_date-1.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "b051ad4cdce84a1de4b1d6ddc01d760d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8001, "upload_time": "2019-08-06T10:02:14", "url": "https://files.pythonhosted.org/packages/3f/e4/13c2c65bf43739a2a0411cd95ec8a7961a53a17ca739118b07eb642a05a9/nepali_date-1.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4ba9fd96c551da0fa6344085eb90da86", "sha256": "5bb511b10da4fbbdd5ccd5f246b0a9890977845f0e212d1553e122e6a89986a7" }, "downloads": -1, "filename": "nepali-date-1.1.0.tar.gz", "has_sig": false, "md5_digest": "4ba9fd96c551da0fa6344085eb90da86", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6108, "upload_time": "2019-08-06T10:02:16", "url": "https://files.pythonhosted.org/packages/41/8d/b2450fbdeeb8c14540ff1670ff7b823492d426ccbfe0b1ede79d41166ec9/nepali-date-1.1.0.tar.gz" } ], "2.0.1": [ { "comment_text": "", "digests": { "md5": "9430de990326350d5004191755ca9e5b", "sha256": "86052ce8d9cb1c1790ff3a7e422579436d5dc3f18b46bcd614996dad5da9a640" }, "downloads": -1, "filename": "nepali-date-2.0.1.tar.gz", "has_sig": false, "md5_digest": "9430de990326350d5004191755ca9e5b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9321, "upload_time": "2019-10-14T04:13:10", "url": "https://files.pythonhosted.org/packages/5d/be/fba0c466a2fd08023e97af9c03f76da5cb8ab8c90794513c26ae4156bc4a/nepali-date-2.0.1.tar.gz" } ], "2.0.2": [ { "comment_text": "", "digests": { "md5": "c6d5fc4c134a3eb7e70d9fb3e976de7b", "sha256": "7a3ac9ed870588b698f967f0d2a2b6d4efa669f0af4c739f59994ef9777a6c39" }, "downloads": -1, "filename": "nepali-date-2.0.2.tar.gz", "has_sig": false, "md5_digest": "c6d5fc4c134a3eb7e70d9fb3e976de7b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9682, "upload_time": "2019-10-15T02:01:23", "url": "https://files.pythonhosted.org/packages/ad/d4/8cbcd0887490416497dce564d66455f1032617eb0bf5f88b88a4e255c82e/nepali-date-2.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c6d5fc4c134a3eb7e70d9fb3e976de7b", "sha256": "7a3ac9ed870588b698f967f0d2a2b6d4efa669f0af4c739f59994ef9777a6c39" }, "downloads": -1, "filename": "nepali-date-2.0.2.tar.gz", "has_sig": false, "md5_digest": "c6d5fc4c134a3eb7e70d9fb3e976de7b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9682, "upload_time": "2019-10-15T02:01:23", "url": "https://files.pythonhosted.org/packages/ad/d4/8cbcd0887490416497dce564d66455f1032617eb0bf5f88b88a4e255c82e/nepali-date-2.0.2.tar.gz" } ] }