Nepali DateNepali DateBikram Sambat Date Engine
Methods

Packagistdate->setDate()

Set the day of the month on a NepaliDate instance and recalculate its timestamp.

The setDate method updates the day of the month for the current NepaliDate instance and recalculates its underlying Gregorian timestamp. It validates the new day against the maximum number of days available in the active month.


Import

use NepaliDateLibrary\NepaliDate;

Signature

public function setDate(int $day): void;

Parameters

ParameterTypeRequiredDescription
$dayintYesTarget day of the month between 1 and 32.

Return Value

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

Example

use NepaliDateLibrary\NepaliDate;

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

Advertisement

On this page