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.1.tar.gz (10.7 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.1-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bsdatetime-1.0.1.tar.gz
  • Upload date:
  • Size: 10.7 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.1.tar.gz
Algorithm Hash digest
SHA256 52a52f57fb2c30aeb85356f3f9c6861eaec9f349fa9f93da13098903084bfe16
MD5 b1f5a9b17366ac86a99d7ebc038c39b2
BLAKE2b-256 f883c7b7d56a9e2e532b60e601d32427ab8cf4d9b9723947d5d06d2b069be561

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bsdatetime-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 10.6 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e9250519ceb6659b9a31a206c8fac24ced9b1ed44e02e709e276d631f9b4dff5
MD5 83eae9345dab6762f26f4aa2b2bd4ba4
BLAKE2b-256 f9f04b326e8c466a3f3b54b1b289d44912416a62ca677c1870456a686fd08def

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