Methods
date->endOfMonth()
Return a new NepaliDate instance set to the final day of the current Bikram Sambat month.
The endOfMonth method returns a new NepaliDate instance positioned on the last valid calendar day of the active month. It automatically checks the calendar map to determine whether the month ends on day 29, 30, 31, or 32, which is useful for monthly reporting and billing cycles.
Import
use NepaliDateLibrary\NepaliDate;Signature
public function endOfMonth(): self;Parameters
- None.
Return Value
- Type:
NepaliDate - Description: New date instance on the final day of the current month.
Example
use NepaliDateLibrary\NepaliDate;
$date = new NepaliDate('2081-01-10');
$lastDay = $date->endOfMonth();
echo $lastDay->format('YYYY-MM-DD'); // Day 31 for Baisakh 2081Related
date->startOfMonth(): First day of the month.date->daysInMonth(): Total days in the month.
Advertisement
date->startOfMonth()
Return a new NepaliDate instance set to the first day of the current Bikram Sambat month.
date->startOfYear()
Return a new NepaliDate instance set to the first day of the Bikram Sambat year on 1 Baisakh.