Methods
date->daysInMonth()
Retrieve the total number of days in the current or specified Bikram Sambat month.
The daysInMonth method returns the total number of days present in the active month of the current NepaliDate instance, or for an explicitly provided year and month combination. Because Bikram Sambat month durations vary from 29 to 32 days depending on astronomical solar calculations, this method provides accurate month lengths.
Import
use NepaliDateLibrary\NepaliDate;Signature
public function daysInMonth(?int $year = null, ?int $month = null): int;Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
$year | int, null | No | null | Optional year to inspect. Defaults to current instance year. |
$month | int, null | No | null | Optional zero based month index. Defaults to current instance month. |
Return Value
- Type:
int - Range:
29to32 - Description: Total number of days in the active month.
Example
use NepaliDateLibrary\NepaliDate;
$date = new NepaliDate('2081-01-01'); // Baisakh 2081
echo "Days in Baisakh 2081: " . $date->daysInMonth(); // 31Related
date->getWeeksInMonth(): Calendar rows for month.NepaliDate::getCalendarDays(): Generate calendar matrix.
Advertisement
date->isLeapYear()
Determine whether the current Bikram Sambat calendar year has three hundred sixty six or more days.
date->getWeeksInMonth()
Calculate the number of calendar week rows required to render the current month in a grid.