Nepali DateNepali DateBikram Sambat Date Engine
Methods

Packagistdate->getWeeksInMonth()

Calculate the number of calendar week rows required to render the current month in a grid.

The getWeeksInMonth method computes the total number of seven day week rows required to display the entire month in a standard calendar grid. Depending on which weekday the month starts on and how many days it contains, the returned count is usually five or six rows.


Import

use NepaliDateLibrary\NepaliDate;

Signature

public function getWeeksInMonth(): int;

Parameters

  • None.

Return Value

  • Type: int
  • Range: 4, 5, or 6
  • Description: Number of week rows needed for a calendar view.

Example

use NepaliDateLibrary\NepaliDate;

$date = new NepaliDate('2081-01-01');
echo "Weeks in month: " . $date->getWeeksInMonth();

Advertisement

On this page