Nepali DateNepali DateBikram Sambat Date Engine
Methods

Packagistdate->set()

Set year, month, and day coordinates simultaneously on a NepaliDate instance.

The set method updates the Bikram Sambat year, zero based month index, and day values of the current NepaliDate instance in a single atomic call. It validates the combined coordinates against the calendar map and recalculates the internal timestamp.


Import

use NepaliDateLibrary\NepaliDate;

Signature

public function set(int $year, int $month, int $date): void;

Parameters

ParameterTypeRequiredDescription
$yearintYesBikram Sambat year integer between 1976 and 2100.
$monthintYesZero based month index from 0 (Baisakh) to 11 (Chaitra).
$dateintYesDay number of the month from 1 to 32.

Return Value

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

Example

use NepaliDateLibrary\NepaliDate;

$date = new NepaliDate('2080-01-01');
$date->set(2081, 6, 15); // Kartik 15, 2081 BS
echo $date->format('YYYY-MM-DD'); // "2081-07-15"

Advertisement

On this page