Nepali DateNepali DateBikram Sambat Date Engine
Methods

Packagistdate->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

ParameterTypeRequiredDefaultDescription
$yearint, nullNonullOptional year to inspect. Defaults to current instance year.
$monthint, nullNonullOptional zero based month index. Defaults to current instance month.

Return Value

  • Type: int
  • Range: 29 to 32
  • 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(); // 31

Advertisement

On this page