Nepali DateNepali DateBikram Sambat Date Engine
Methods

Packagistdate->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: 0 to 6
  • Description: Day of the week integer starting from 0 for Sunday up to 6 for 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"

Advertisement

On this page