Skip to main content

Bangla is a Python package for converting Gregorian dates to the Bengali calendar, translating English numerals to Bangla numerals, and generating Bangla ordinals for dates.

Project description

Python Size

Bangla is a Python package for converting Gregorian dates to the Bengali calendar, translating English numerals to Bangla numerals, and generating Bangla ordinals for dates. It computes the full Bengali calendar date, including year, month, day, weekday, season, and ordinal based on the revised Bengali calendar (https://en.wikipedia.org/wiki/Bengali_calendars) officially adopted in Bangladesh in 1987. (For Bengali communities in India, the calendar may differ slightly.)

The package also allows converting English numeric strings (e.g., “123”) into Bangla numerals (e.g., “১২৩”). It is compatible with Linux, macOS, and Windows systems.

Features

  • Convert Gregorian dates to Bengali calendar , including:: - Bangla Date (১-৩১)

    • Bangla Month (“বৈশাখ”, “জ্যৈষ্ঠ”, “আষাঢ়”, “শ্রাবণ”, “ভাদ্র”, “আশ্বিন”, “কার্তিক”, “অগ্রহায়ণ”, “পৌষ”, “মাঘ”, “ফাল্গুন”, “চৈত্র”)

    • Bangla Year (১৯৮৭ - )

    • Bangla Season (“গ্রীষ্ম”, “বর্ষা”, “শরৎ”, “হেমন্ত”, “শীত”, “বসন্ত”)

    • Bangla Weekday (“শনিবার”, “রবিবার”, “সোমবার”, “মঙ্গলবার”, “বুধবার”, “বৃহস্পতিবার”, “শুক্রবার”)

    • Bangla Weekday (“শনিবার”, “রবিবার”, “সোমবার”, “মঙ্গলবার”, “বুধবার”, “বৃহস্পতিবার”, “শুক্রবার”)

    • Bangla Ordinal for dates (“পহেলা”, “দোসরা”, “তেসরা”, … , “একত্রিশে”)

  • Convert English numeric string to Bangla numeric string (123456 -> ১২৩৪৫৬).

Installation

We recommend install bangla through pip install.

$ pip install bangla

Example

To get today’s date in Bangla calendar:

import bangla
bangla_date = bangla.get_date()
print(bangla_date)
# Output: {'date': '৮', 'month': 'আষাঢ়', 'year': '১৪২৪', 'season': 'বর্ষা', 'weekday': 'বৃহস্পতিবার'}
# Use bangla.get_date(ordinal = True) to include the Bangla ordinal

To convert any Gregorian date to Bangla date :

import bangla
bangla_date = bangla.get_date(20, 6, 2017) # date, month, year
print(bangla_date)
# Output: {'date': '৬', 'month': 'আষাঢ়', 'year': '১৪২৪', 'season': 'বর্ষা', 'weekday': 'মঙ্গলবার'}

To convert any English numeric string to Bangla numeric string :

import bangla
bangla_numeric_string = bangla.convert_english_digit_to_bangla_digit("123456")
print(bangla_numeric_string)
# Output: ১২৩৪৫৬

Contributors

Contributors

Want to contribute?

Submit a Github Pull Request (must add/update unittests) https://github.com/arsho/bangla/pulls

For suggestions or feedback, please contact https://arshovon.com/

Thanks

Influenced by বঙ্গাব্দ - jQuery Plugin https://github.com/nuhil/bangla-calendar

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

bangla-0.0.5.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

bangla-0.0.5-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file bangla-0.0.5.tar.gz.

File metadata

  • Download URL: bangla-0.0.5.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for bangla-0.0.5.tar.gz
Algorithm Hash digest
SHA256 ad7dbfad451ff60e28b5830d5f42c33d74880d16c813cc5197de4d6a61f34704
MD5 8b524d5a350d949c982b431c1bb815ff
BLAKE2b-256 6734800f506adb22c523a39f8bea2c56625fb1e585d6a1fbedeae29443047a19

See more details on using hashes here.

File details

Details for the file bangla-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: bangla-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for bangla-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 0da1ba3a892a7d08bf8b8906baddc3e3c04d895e88da42fba866f5ecd990764c
MD5 c22611b7a88ce55dcbee5027e7414e49
BLAKE2b-256 e69f73d69c27f2daf35c7d1ae0de6d8d97fa43f0507b1f25444111d313b7679b

See more details on using hashes here.

Supported by

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