Methods
date->getDay()
Retrieve the numeric day of the week index from zero for Sunday through six for Saturday.
The getDay method returns an integer representing the day of the week for the current NepaliDate instance. The return value ranges from 0 for Sunday to 6 for Saturday, aligning with standard calendar day conventions.
Import
use NepaliDateLibrary\NepaliDate;Signature
public function getDay(): int;Parameters
- None.
Return Value
- Type:
int - Range:
0to6 - Description: Day of the week integer starting from
0for Sunday up to6for Saturday.
Example
use NepaliDateLibrary\NepaliDate;
use NepaliDateLibrary\Helper\Constants;
$date = new NepaliDate('2081-07-15');
$weekdayIndex = $date->getDay();
echo $weekdayIndex . PHP_EOL; // 5 (Friday)
echo Constants::$WEEK_EN[$weekdayIndex]; // "Friday"Related
NepaliDate::getDayName(): Retrieve localized weekday names.date->getDate(): Retrieve the day of the month.
Advertisement
date->getDate()
Retrieve the numeric day of the month from a NepaliDate instance.
date->getHours()
Retrieve the hour component from zero to twenty three for the current date instance.