Nepali DateNepali DateBikram Sambat Date Engine
Methods

Packagistdate->setMonth()

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

The setMonth 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

use NepaliDateLibrary\NepaliDate;

Signature

public function setMonth(int $month): void;

Parameters

ParameterTypeRequiredDescription
$monthintYesTarget zero based month index from 0 to 11.

Return Value

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

Example

use NepaliDateLibrary\NepaliDate;

$date = new NepaliDate('2081-01-31');
// Change to month index 1 (Jestha)
$date->setMonth(1);
echo $date->format('YYYY-MM-DD');

Advertisement

On this page