Nepali DateNepali DateBikram Sambat Date Engine
Methods

date.set_year()

Set the Bikram Sambat year on a NepaliDate instance within the supported calendar range.

The set_year method updates the four digit Bikram Sambat year on the current NepaliDate instance and adjusts the timestamp accordingly. The target year must fall within the supported range between 1976 and 2100 BS.


Import

from nepali_date_library import NepaliDate

Signature

def set_year(self, year: int) -> None:

Parameters

ParameterTypeRequiredDescription
yearintYesTarget Bikram Sambat year between 1976 and 2100.

Return Value

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

Example

from nepali_date_library import NepaliDate

date = NepaliDate("2080-07-15")
date.set_year(2081)
print(date.format("YYYY-MM-DD")) # "2081-07-15"

Advertisement

On this page