Methods
date->getMonth()
Retrieve the zero based Bikram Sambat month index from zero for Baisakh to eleven for Chaitra.
The getMonth method returns the month of the year as an integer between 0 and 11 for the current NepaliDate instance. The library adheres to the zero based indexing standard where 0 represents Baisakh, 1 represents Jestha, and 11 represents Chaitra.
Import
use NepaliDateLibrary\NepaliDate;Signature
public function getMonth(): int;Parameters
- None.
Return Value
- Type:
int - Range:
0to11 - Description: Zero based month index from Baisakh (
0) to Chaitra (11).
Example
use NepaliDateLibrary\NepaliDate;
$date = new NepaliDate('2081-07-15'); // Kartik
echo $date->getMonth(); // 6 (Kartik is index 6)Related
date->setMonth(): Mutate the month component.NepaliDate::getMonthName(): Look up the month name.
Advertisement
date->getYear()
Retrieve the four digit Bikram Sambat year number from a NepaliDate instance.
date->getDate()
Retrieve the numeric day of the month from a NepaliDate instance.