I'm trying to find first and last week days based on the locale.
In U.S.A. a week normally starts on Sunday, but in other countries it could start on another day - e.g. Monday or even Saturday.
setlocale(LC_ALL, "en_US.UTF-8");
date_default_timezone_set("America/New_York");
$start_week = (new DateTimeImmutable());
$start_week = $start_week->modify('this week');
$end_week = $start_week->modify('this week +6 days');
$interval = new DateInterval('P1D');
$week_range = new DatePeriod($start_week, $interval, $end_week);
foreach($week_range as $week_day) {
// $week_day starts with Monday, supposed to be Sunday
}