Nepali DateNepali DateBikram Sambat Date Engine
Methods

Packagistdate->setYear()

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

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

use NepaliDateLibrary\NepaliDate;

Signature

public function setYear(int $year): void;

Parameters

ParameterTypeRequiredDescription
$yearintYesTarget Bikram Sambat year between 1976 and 2100.

Return Value

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

Example

use NepaliDateLibrary\NepaliDate;

$date = new NepaliDate('2080-07-15');
$date->setYear(2081);
echo $date->format('YYYY-MM-DD'); // "2081-07-15"

Advertisement

On this page