How to get next or last Day by given a date input in php?

next or last Day by given a date input

Here is the code to do it. try it and comment if you got error.

$mydate= '2014-11-11';

$time = strtotime($mydate);

$start = strtotime('last sunday', $time);

$end = strtotime('next saturday', $time);

$format = 'l, F j, Y ';

$start_day = date($format, $start);

$end_day = date($format, $end); 

echo "Mydate: $s\nResult: $start_day - $end_day";

Be the first to comment

Leave a Reply

Your email address will not be published.


*