# Nepali Datetime (Bikram Sambat Date & Nepal Time)
The package inspired from Python's core `datetime` package that
operates on top of Bikram Sambat (B.S) Date & Nepal Time (NPT) `+05:45`.
> Supports: **Python 3.5+**
## Basic Usage
```python
# importing
>>> import datetime
>>> import nepali_datetime
# today's date
>>> datetime.date.today()
>>> nepali_datetime.date.today()
# now datetime
>>> datetime.datetime.now()
>>> nepali_datetime.datetime.now()
# creating date object
>>> datetime.date(2020, 9, 4)
>>> nepali_datetime.date(2077, 5, 19)
# creating datetime object
>>> datetime.datetime(2020, 9, 4, 8, 26, 10, 123456)
>>> nepali_datetime.datetime(2077, 5, 19, 8, 26, 10, 123456)
# date/datetime formatting
>>> nepali_datetime.datetime(2077, 5, 19, 8, 26, 10, 123456).strftime("%d %B %Y")
# 19 Bhadau 2077
# datetime parsed from string (strptime)
>>> nepali_datetime.datetime.strptime('2077-09-12', '%Y-%m-%d')
# nepali_datetime.datetime(2077, 9, 12, 0, 0)
# date/datetime formatting with Nepali unicode support
>>> nepali_datetime.date(1977, 10, 25).strftime('%K-%n-%D (%k %N %G)')
# १९७७-१०-२५ (७७ माघ आइतबार)
# datetime.timedelta addition/subtraction
>>> nepali_datetime.date(1990, 5, 10) + datetime.timedelta(days=350)
# nepali_datetime.date(1991, 4, 26)
>>> nepali_datetime.datetime(1990, 5, 10, 5, 10, 20) + datetime.timedelta(hours=3, minutes=15)
# nepali_datetime.date(1990, 5, 10, 8, 25, 20)
# convert B.S to A.D date and vice-versa
>>> nepali_datetime.date(1999, 7, 25).to_datetime_date()
# datetime.date(1942, 11, 10)
>>> nepali_datetime.date.from_datetime_date(datetime.date(1942, 11, 10))
# nepali_datetime.date(1999, 7, 25)
# Bikram Sambat monthly calendar
>>> nepali_datetime.date(2078, 1, 1).calendar()
Baishakh 2078
Sun Mon Tue Wed Thu Fri Sat
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
```
## Installation
```shell
$ pip install nepali-datetime
```
## Documentation
Complete usage documentations can be found [here](https://amitgaru2.github.io/nepali-datetime/).
## Contribution
Any contributions are most welcome. Do check this guidelines [CONTRIBUTING.md](https://github.com/amitgaru2/nepali-datetime/blob/master/CONTRIBUTING.md) for code contribution.
Raw data
{
"_id": null,
"home_page": "https://github.com/amitgaru2/nepali-datetime",
"name": "nepali-datetime",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.5",
"maintainer_email": null,
"keywords": "nepali, bs, b.s, date, datetime, time, timezone, nepal, bikram, sambat, samvat, nepali-date, nepali-datetime, nepal-time, npt, nepal-timezone",
"author": "Amit Garu <amitgaru2@gmail.com>",
"author_email": "amitgaru2@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/92/ec/66abf51809a55af27589e2d0db865d32c2661e2d9e440535b229b94e2729/nepali_datetime-1.0.8.3.tar.gz",
"platform": null,
"description": "# Nepali Datetime (Bikram Sambat Date & Nepal Time)\n\nThe package inspired from Python's core `datetime` package that\noperates on top of Bikram Sambat (B.S) Date & Nepal Time (NPT) `+05:45`.\n\n> Supports: **Python 3.5+**\n\n\n## Basic Usage\n\n```python\n# importing\n>>> import datetime\n>>> import nepali_datetime\n\n# today's date\n>>> datetime.date.today()\n>>> nepali_datetime.date.today()\n\n# now datetime\n>>> datetime.datetime.now()\n>>> nepali_datetime.datetime.now()\n\n# creating date object\n>>> datetime.date(2020, 9, 4)\n>>> nepali_datetime.date(2077, 5, 19)\n\n# creating datetime object\n>>> datetime.datetime(2020, 9, 4, 8, 26, 10, 123456)\n>>> nepali_datetime.datetime(2077, 5, 19, 8, 26, 10, 123456)\n\n# date/datetime formatting\n>>> nepali_datetime.datetime(2077, 5, 19, 8, 26, 10, 123456).strftime(\"%d %B %Y\")\n# 19 Bhadau 2077\n\n# datetime parsed from string (strptime)\n>>> nepali_datetime.datetime.strptime('2077-09-12', '%Y-%m-%d')\n# nepali_datetime.datetime(2077, 9, 12, 0, 0)\n\n# date/datetime formatting with Nepali unicode support\n>>> nepali_datetime.date(1977, 10, 25).strftime('%K-%n-%D (%k %N %G)')\n# \u0967\u096f\u096d\u096d-\u0967\u0966-\u0968\u096b (\u096d\u096d \u092e\u093e\u0918 \u0906\u0907\u0924\u092c\u093e\u0930)\n\n# datetime.timedelta addition/subtraction\n>>> nepali_datetime.date(1990, 5, 10) + datetime.timedelta(days=350)\n# nepali_datetime.date(1991, 4, 26)\n>>> nepali_datetime.datetime(1990, 5, 10, 5, 10, 20) + datetime.timedelta(hours=3, minutes=15)\n# nepali_datetime.date(1990, 5, 10, 8, 25, 20)\n\n# convert B.S to A.D date and vice-versa\n>>> nepali_datetime.date(1999, 7, 25).to_datetime_date()\n# datetime.date(1942, 11, 10)\n>>> nepali_datetime.date.from_datetime_date(datetime.date(1942, 11, 10))\n# nepali_datetime.date(1999, 7, 25)\n\n# Bikram Sambat monthly calendar\n>>> nepali_datetime.date(2078, 1, 1).calendar()\n\n Baishakh 2078\nSun Mon Tue Wed Thu Fri Sat\n 1 2 3 4\n5 6 7 8 9 10 11\n12 13 14 15 16 17 18\n19 20 21 22 23 24 25\n26 27 28 29 30 31\n```\n\n## Installation\n\n```shell\n$ pip install nepali-datetime\n```\n\n## Documentation\n\nComplete usage documentations can be found [here](https://amitgaru2.github.io/nepali-datetime/).\n\n## Contribution\n\nAny contributions are most welcome. Do check this guidelines [CONTRIBUTING.md](https://github.com/amitgaru2/nepali-datetime/blob/master/CONTRIBUTING.md) for code contribution.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Datetime module that operates on top of Bikram Sambat Date & Nepal Time.",
"version": "1.0.8.3",
"project_urls": {
"Homepage": "https://github.com/amitgaru2/nepali-datetime"
},
"split_keywords": [
"nepali",
" bs",
" b.s",
" date",
" datetime",
" time",
" timezone",
" nepal",
" bikram",
" sambat",
" samvat",
" nepali-date",
" nepali-datetime",
" nepal-time",
" npt",
" nepal-timezone"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ee750332b195eac421f7527b98a666801eee1cc3204cdc4c4f4fb2b235be8bb3",
"md5": "2281bebac7ccbbe57f540fc28c20f7f5",
"sha256": "98af537f23da2381455fbd686fa7bc071426d8d3a7039068d786051dbde55b71"
},
"downloads": -1,
"filename": "nepali_datetime-1.0.8.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2281bebac7ccbbe57f540fc28c20f7f5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.5",
"size": 18568,
"upload_time": "2024-09-28T16:13:09",
"upload_time_iso_8601": "2024-09-28T16:13:09.074141Z",
"url": "https://files.pythonhosted.org/packages/ee/75/0332b195eac421f7527b98a666801eee1cc3204cdc4c4f4fb2b235be8bb3/nepali_datetime-1.0.8.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "92ec66abf51809a55af27589e2d0db865d32c2661e2d9e440535b229b94e2729",
"md5": "18e98f7beaeba5cac224284b7e04e268",
"sha256": "160df7abef59d1fa36f8d0d151501a873291e51075acab84886d850994b7705e"
},
"downloads": -1,
"filename": "nepali_datetime-1.0.8.3.tar.gz",
"has_sig": false,
"md5_digest": "18e98f7beaeba5cac224284b7e04e268",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.5",
"size": 20226,
"upload_time": "2024-09-28T16:13:10",
"upload_time_iso_8601": "2024-09-28T16:13:10.636028Z",
"url": "https://files.pythonhosted.org/packages/92/ec/66abf51809a55af27589e2d0db865d32c2661e2d9e440535b229b94e2729/nepali_datetime-1.0.8.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-28 16:13:10",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "amitgaru2",
"github_project": "nepali-datetime",
"travis_ci": true,
"coveralls": false,
"github_actions": true,
"lcname": "nepali-datetime"
}