Nepali Datetime (Bikram Sambat Date & Nepal Time)
The package is inspired by 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 a date object
>>> datetime.date(2020, 9, 4)
>>> nepali_datetime.date(2077, 5, 19)
# creating a 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
$ pip install nepali-datetime
Documentation
Complete usage documentation can be found here.
Contribution
Any contributions are most welcome. Do check these guidelines CONTRIBUTING.md for code contribution.
Metadata
Release files for nepali-datetime 1.0.8.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nepali_datetime-1.0.8.5.tar.gz | 20.4 kB | Without provenance | Details for nepali_datetime-1.0.8.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nepali_datetime-1.0.8.5-py3-none-any.whl | Python 3 | none | any | Details for nepali_datetime-1.0.8.5-py3-none-any.whl |
Total release size: 39.0 kB
Release files / nepali_datetime-1.0.8.5.tar.gz
| Download URL | nepali_datetime-1.0.8.5.tar.gz |
|---|---|
| Size | 20.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
745093e929cfe164e1062058221e9a9eac25d89083b1b43b3bb2aa8e854f2884
|
|
BLAKE2b-256 checksum How to use checksums |
7325dac3e744b0a6af03e05a25ab868a032d51993d0e91be70ea38b814b4c047
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / nepali_datetime-1.0.8.5-py3-none-any.whl
| Download URL | nepali_datetime-1.0.8.5-py3-none-any.whl |
|---|---|
| Size | 18.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
adec683e06333482d31543d0d2bdf195cef12505615eaf747bcae0b82e5f6ad2
|
|
BLAKE2b-256 checksum How to use checksums |
d0416ef290b5ab1671a0d421d105ee59d3d02b5c96004ba77f2ccb0b99a55e8f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for nepali-datetime 1.0.8.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.