Datetime module that operates on Bikram Sambat & 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
.
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
>>> 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 monthly 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
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
nepali-datetime-1.0.5.1.tar.gz
(16.8 kB
view hashes)
Built Distribution
Close
Hashes for nepali_datetime-1.0.5.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8df727bbecbf2e7445801793a8c903e7081292569c99ad1d5362eac3e9a38291 |
|
MD5 | c4a9075a1edbe27fcf36744961a9b407 |
|
BLAKE2b-256 | 91c8599ef0ee13d13c5ed929505716b2423fb66cfa85415779b9685d3bc295d5 |