PHP inherently supports ISO date format. With slight modifications we can still detect the start and end days of the week.
Source code viewer
// 0 - Sunday, 1 - Monday $week_start_day = 0; $date_time_from = new DateTime('now'); $date_time_to = clone $date_time_from; $this_week_first_day = $date_time_from->setISODate( $date_time_from->format('Y'), $date_time_from->format('W'), $week_start_day ); $this_week_last_day = $date_time_to->setISODate( $date_time_to->format('Y'), $date_time_to->format('W'), (6 + $week_start_day) ); // Set time to the start of day and end of day, correspondingly. $this_week_first_day->modify('00:00:00.000000'); $this_week_last_day->modify('23:59:59.999999');Programming Language: PHP