PHP: Add days except Sunday

I need to add days in the given date but i need to exclude Sunday.

Here is my code which is working fine but i am not able to exclude the Sunday.

    $service_start_date = new DateTime('2020-10-18');
    $service_end_date = new DateTime('2020-10-25');
//echo $service_start_date;
   $daterange = new DatePeriod($service_start_date, new DateInterval('P1D'), $service_end_date);
       foreach($daterange as $date){
         $service_date = $date->format("Y-m-d");
         echo $service_date;
    }


Read more here: https://stackoverflow.com/questions/64413596/php-add-days-except-sunday

Content Attribution

This content was originally published by Rocx at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: