Methods
date->addDays()
Add or subtract a specified number of days to a NepaliDate instance with automatic month and year rollover.
The addDays method modifies the current NepaliDate instance by adding or subtracting a given integer number of days. It automatically handles variable Bikram Sambat month day counts, transitions across month boundaries, and advances or decrements the year when needed.
Import
use NepaliDateLibrary\NepaliDate;Signature
public function addDays(int $days): self;Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
$days | int | Yes | Positive or negative number of days to add. |
Return Value
- Type:
NepaliDate - Description: Returns
$thisafter mutating internal coordinates.
Example
use NepaliDateLibrary\NepaliDate;
$date = new NepaliDate('2081-01-25');
$date->addDays(10);
echo $date->format('YYYY-MM-DD'); // Transitions into JesthaRelated
date->addMonths(): Add or subtract months.date->diff(): Calculate day differences.
Advertisement
date->parse()
Parse a formatted Bikram Sambat date string and update the current date instance in place.
date->addMonths()
Add or subtract months to a NepaliDate instance while adjusting for variable month lengths.