Skip to main content

Bikram Sambat (Nepali) date/datetime conversion and utilities

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bsdatetime-1.0.0.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bsdatetime-1.0.0-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file bsdatetime-1.0.0.tar.gz.

File metadata

  • Download URL: bsdatetime-1.0.0.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for bsdatetime-1.0.0.tar.gz
Algorithm Hash digest
SHA256 9e4a9f81022350ebd83bc4076181f754df500ca8334970f3a12a1c949ba4a4ee
MD5 0c49f995768f859235a12ee5054f2888
BLAKE2b-256 83b8455f4795a5cda9ee74bb662676aafefeea8e68592e17d810f8d52e3b05a2

See more details on using hashes here.

File details

Details for the file bsdatetime-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: bsdatetime-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for bsdatetime-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6b4d90e37cca1d2a7e3af10119ac742cd7e6626f1188d2097655b71c9b2f8c8c
MD5 06bd4f9018911730a7551f2eb37cdca7
BLAKE2b-256 8959927c2267c2280e03c6a2047099582c33275b28ab6fd405c8094c220dc804

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page