Nepali DateNepali DateBikram Sambat Date Engine
Methods

date.set_english_date()

Update internal Bikram Sambat coordinates from a native Python datetime object.

The set_english_date method converts a native Python datetime object into Bikram Sambat coordinates and updates the current NepaliDate instance in place. It recalculates the year, month, and day coordinates based on historical ephemeris tables.


Import

from nepali_date_library import NepaliDate

Signature

def set_english_date(self, date: datetime) -> None:

Parameters

ParameterTypeRequiredDescription
datedatetimeYesGregorian datetime object to convert.

Return Value

  • Type: None
  • Note: Mutates the current instance in place.

Example

from datetime import datetime, timezone
from nepali_date_library import NepaliDate

nd = NepaliDate()
gregorian = datetime(2023, 4, 14, tzinfo=timezone.utc)
nd.set_english_date(gregorian)

print(nd.format("YYYY-MM-DD")) # "2080-01-01"

Advertisement

On this page