Methods
date.add_days()
Add or subtract a specified number of days to a NepaliDate instance with automatic month and year rollover.
The add_days method modifies the current NepaliDate instance by adding or subtracting a given integer number of days. It automatically handles variable Bikram Sambat month day counts, transitions across month boundaries, and advances or decrements the year when needed.
Import
from nepali_date_library import NepaliDateSignature
def add_days(self, days: int) -> NepaliDate:Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
days | int | Yes | Positive or negative number of days to add. |
Return Value
- Type:
NepaliDate - Description: Returns
selfafter mutating the internal coordinates.
Example
from nepali_date_library import NepaliDate
date = NepaliDate("2081-01-25")
date.add_days(10)
print(date.format("YYYY-MM-DD")) # Transitions into JesthaRelated
date.add_months(): Add or subtract months.date.diff(): Calculate day differences.
Advertisement
date.parse()
Parse a formatted Bikram Sambat date string and update the current date instance in place.
date.add_months()
Add or subtract months to a NepaliDate instance while adjusting for variable month lengths.