Methods
date.get_english_date()
Retrieve the equivalent Gregorian date as a native JavaScript Date object.
The get_english_date method returns the native Python datetime object corresponding to the current NepaliDate instance. This allows seamless integration with third party libraries, databases, and standard Python APIs that expect a native Gregorian datetime object.
Import
from nepali_date_library import NepaliDateSignature
def get_english_date(self) -> datetime:Parameters
- None.
Return Value
- Type:
datetime - Description: Native Python datetime object in UTC matching the current Bikram Sambat date.
Example
from nepali_date_library import NepaliDate
nd = NepaliDate("2081-07-15")
ad_date = nd.get_english_date()
print(type(ad_date)) # <class 'datetime.datetime'>
print(ad_date.strftime("%Y-%m-%d")) # "2024-10-31"Related
BStoAD(): String based date conversion.date.set_english_date(): Update instance from datetime.
Advertisement
date.get_time()
Retrieve the numeric timestamp in milliseconds since the Unix epoch.
date.set()
Set year, month, and day coordinates simultaneously on a NepaliDate instance.