startOfWeek.php
Table of Contents
Functions
- startOfWeek() : DateTimeImmutable
- Returns the first representable instant of the week containing a date.
Functions
startOfWeek()
Returns the first representable instant of the week containing a date.
startOfWeek(DateTimeInterface $date[, int $firstDayOfWeek = 1 ]) : DateTimeImmutable
A new DateTimeImmutable is returned, set to 00:00:00.000000 on the first day of
the week ; the source date is never modified. The timezone of the returned value is
the one carried by $date.
$firstDayOfWeek uses the ISO-8601 numbering also returned by DateTime::format( 'N' )
: 1 for Monday through 7 for Sunday. It defaults to 1 (ISO-8601 / most of the
world) ; pass 7 for the US/Canada convention (week starts on Sunday).
Parameters
- $date : DateTimeInterface
-
The source date.
- $firstDayOfWeek : int = 1
-
The first day of the week,
1(Monday) to7(Sunday). Default1.
Tags
Return values
DateTimeImmutable —A new immutable date, at the start of the week containing $date.