Nepali DateNepali DateBikram Sambat Date Engine
Methods

date.set_month()

Set the Bikram Sambat month index on a NepaliDate instance with automatic day clamping.

The set_month method updates the Bikram Sambat month for the current NepaliDate instance using a zero based month index from 0 for Baisakh to 11 for Chaitra. If the current day exceeds the total days in the destination month, the day is automatically clamped to the final valid day of that month.


Import

from nepali_date_library import NepaliDate

Signature

def set_month(self, month: int) -> None:

Parameters

ParameterTypeRequiredDescription
monthintYesTarget zero based month index from 0 to 11.

Return Value

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

Example

from nepali_date_library import NepaliDate

date = NepaliDate("2081-01-31")
# Change to month index 1 (Jestha)
date.set_month(1)
print(date.format("YYYY-MM-DD"))

Advertisement

On this page