Skip to main content

bsdatetime

Lightweight, dependency‑free Bikram Sambat (Nepali) calendar utilities for Python.

Documentation: https://rajendra-katuwal.github.io/bsdatetime.docs/

What it does

  • Convert between Gregorian (AD) and Bikram Sambat (BS)
  • Format / parse BS dates (localized month + weekday names)
  • Validate dates, get fiscal year, week number, ranges
  • Provide current BS date/time helpers

Install

pip install bsdatetime

Quick start

import datetime, bsdatetime as bs

ad = datetime.date(2024, 12, 25)
bs_tuple = bs.ad_to_bs(ad)          # (2081, 9, 9)
ad_back = bs.bs_to_ad(*bs_tuple)    # 2024-12-25
text = bs.format_bs_date(*bs_tuple, "%B %d, %Y")  # भदौ 09, 2081
current_bs = bs.utils.get_current_bs_date()

Core API (most used)

  • ad_to_bs(date)
  • bs_to_ad(y, m, d)
  • format_bs_date(y, m, d, fmt)
  • parse_bs_date(text, fmt)
  • is_valid_bs_date(y, m, d)
  • utils.get_current_bs_date()

Supported range: BS 1975–2100 (≈ AD 1918–2043)

Django?

Use the companion package for model fields:

pip install django-bsdatetime

License

MIT

Metadata

Release files for bsdatetime 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bsdatetime 1.0.1
File Size Uploaded
bsdatetime-1.0.1.tar.gz 10.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bsdatetime 1.0.1
File Interpreter ABI Platform
bsdatetime-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 21.3 kB

Release files / bsdatetime-1.0.1.tar.gz

Download URL bsdatetime-1.0.1.tar.gz
Size 10.7 kB
Tags Source
SHA-256 checksum
How to use checksums
52a52f57fb2c30aeb85356f3f9c6861eaec9f349fa9f93da13098903084bfe16
BLAKE2b-256 checksum
How to use checksums
f883c7b7d56a9e2e532b60e601d32427ab8cf4d9b9723947d5d06d2b069be561
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / bsdatetime-1.0.1-py3-none-any.whl

Download URL bsdatetime-1.0.1-py3-none-any.whl
Size 10.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e9250519ceb6659b9a31a206c8fac24ced9b1ed44e02e709e276d631f9b4dff5
BLAKE2b-256 checksum
How to use checksums
f9f04b326e8c466a3f3b54b1b289d44912416a62ca677c1870456a686fd08def
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page