Methods
date->startOfWeek()
Return a new NepaliDate instance set to the first day of the week on Sunday.
The startOfWeek method returns a new NepaliDate instance set to Sunday, the first day of the weekly cycle containing the current date. It serves as an anchor date for week based scheduling and calendar grids.
Import
use NepaliDateLibrary\NepaliDate;Signature
public function startOfWeek(int $startOfWeek = 0): self;Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
$startOfWeek | int | No | 0 | Weekday index to treat as week start (0 for Sunday). |
Return Value
- Type:
NepaliDate - Description: New date instance set to the first day of the week.
Example
use NepaliDateLibrary\NepaliDate;
$date = new NepaliDate('2081-07-15');
$weekStart = $date->startOfWeek();
echo $weekStart->getDay(); // 0 (Sunday)Related
date->endOfWeek(): Saturday boundary of the week.date->startOfMonth(): First day of the month.
Advertisement
date->endOfDay()
Return a new NepaliDate instance set to the final millisecond of the current day.
date->endOfWeek()
Return a new NepaliDate instance set to the final day of the current week on Saturday.