Methods
date.parse()
Parse a formatted Bikram Sambat date string and update the current date instance in place.
The parse method parses a Bikram Sambat date string and updates the coordinates of the current NepaliDate instance in place. It supports various delimiter styles including slashes, dots, and hyphens, recalculating the underlying timestamp upon successful parsing.
Import
from nepali_date_library import NepaliDateSignature
def parse(self, date_string: str) -> None:Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
date_string | str | Yes | Formatted Bikram Sambat date string (e.g. "2081-07-15"). |
Return Value
- Type:
None - Note: Mutates the current instance in place.
Example
from nepali_date_library import NepaliDate
date = NepaliDate()
date.parse("2081-07-15")
print(date.format("YYYY-MM-DD")) # "2081-07-15"Related
NepaliDate Constructor: Create instances from strings.date.format(): Format dates to strings.
Advertisement
date.set_english_date()
Update internal Bikram Sambat coordinates from a native Python datetime object.
date.add_days()
Add or subtract a specified number of days to a NepaliDate instance with automatic month and year rollover.