Methods
date->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
| Parameter | Type | Required | Description |
|---|---|---|---|
$day | int | Yes | Target 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"Related
date->getDate(): Retrieve day of the month.date->addDays(): Add or subtract days.
Advertisement
date->setMonth()
Set the Bikram Sambat month index on a NepaliDate instance with automatic day clamping.
date->parse()
Parse a formatted Bikram Sambat date string and update the current date instance in place.