Datetime module that operates on Bikram Sambat & Nepal time.
Project description
Nepali Datetime (Bikram Sambat B.S & Nepal Time NPT)
The package similar to Python's core datetime
package that
operates on Bikram Sambat (B.S) date & Nepal Time +05:45
.
Usage
The Python3
core datetime
library usage VS nepali_datetime
usage.
# importing the module
>>> import datetime
>>> import nepali_datetime
# getting today's date
>>> datetime.date.today()
>>> nepali_datetime.date.today()
# getting 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
>>> datetime.datetime(2020, 9, 4, 8, 26, 10, 123456).strftime("%d %B %Y") # 04 September 2020
>>> nepali_datetime.datetime(2077, 5, 19, 8, 26, 10, 123456).strftime("%d %B %Y") # 19 Bhadau 2077
# datetime parsed from string (strptime)
>>> datetime.datetime.strptime('2020-12-27', '%Y-%m-%d') # datetime.datetime(2020, 12, 27, 0, 0)
>>> nepali_datetime.datetime.strptime('2077-09-12', '%Y-%m-%d') # nepali_datetime.datetime(2077, 9, 12, 0, 0)
# date/datetime formatting with Nepali month unicode support
>>> nepali_datetime.date(2078, 1, 10).strftime('%N') # वैशाख
# BS calendar
>>> nepali_datetime.date.today().calendar()
Kartik 2077
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
# ... and many more
*Note: The equivalence is not limited to just getting current datetime. Its supports most of the methods from Python's core datetime library. Check documentation for more details.
Installation
$ pip install nepali-datetime
Documentation
Complete documentations can be found here.
Contribution
For contribution check the guidelines in CONTRIBUTING.md.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file nepali-datetime-1.0.5.tar.gz
.
File metadata
- Download URL: nepali-datetime-1.0.5.tar.gz
- Upload date:
- Size: 17.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1225a66204aa62e433952efc5a21a764dc9aa1d1d931ed45019c46ee98cad8d7 |
|
MD5 | e11be705f5f10ceae518358522ff7918 |
|
BLAKE2b-256 | 1e806d418280047afb23c3418471ef74034f943b632b7d725b46d4cb4e916ae8 |
File details
Details for the file nepali_datetime-1.0.5-py3-none-any.whl
.
File metadata
- Download URL: nepali_datetime-1.0.5-py3-none-any.whl
- Upload date:
- Size: 16.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 04aee848f18365861fffabaed4e8e70be82bb0e09932070ec690b37b44c1db6f |
|
MD5 | 18f5031d3ffe88e048aa9514cdce1f20 |
|
BLAKE2b-256 | 0f4ce3e42b4c2db5b92a95cc981ebb3848fcb4b6f95d3f8be4deab9f2159ed3e |