Datetime module that operates on top of Bikram Sambat Date & Nepal Time.
Project description
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
# 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)
# 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
$ pip install nepali-datetime
Documentation
Complete documentations is here.
Contribution
Any contributions are most welcome. Do 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
nepali-datetime-1.0.7.tar.gz
(17.4 kB
view details)
Built Distribution
File details
Details for the file nepali-datetime-1.0.7.tar.gz
.
File metadata
- Download URL: nepali-datetime-1.0.7.tar.gz
- Upload date:
- Size: 17.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 706e76bebe989fbe13703a938ce20d6c1f7ab6e40b8969c33c005d9569c2f1a8 |
|
MD5 | ae12f2b41eaa73ca01baa2dfa73bef0b |
|
BLAKE2b-256 | f28cc7a769be082bd91be1a6c2e4b3482e99f1a68c4bf14b54734f2afc72b79f |
File details
Details for the file nepali_datetime-1.0.7-py3-none-any.whl
.
File metadata
- Download URL: nepali_datetime-1.0.7-py3-none-any.whl
- Upload date:
- Size: 16.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7154fcfb0cc2233fb4da0e40657c611cff135cc517504910e2a1c30911782574 |
|
MD5 | 12ad3d8fd2c22ab90d10dce33444d2aa |
|
BLAKE2b-256 | d59171e5ce0f81e982cdb1dbecc8e763aa6f9733cbe0d6a0e3f9bc23832d2c8b |