Pick up current PHP week days

Asked

Viewed 441 times

3

How can I get the days of the current week? For example: This week I would like to show the following sentence:

Events of October 15-19

Even if it is on the 16th/10th, continue showing from the 15th to the 19th of October. I tried the code below, but when I change the date, it marks the date that was changed.

$p = strtotime("0 week");
echo date('d/m/Y', $p)."<br>";
$u = strtotime("4 days");
echo date('d/m/Y', $u)."<br>";

I tried that way too:

echo date("d-m-Y",strtotime("last Monday"));
echo "<br>";
echo date("d-m-Y",strtotime("next Friday"));

I understand that the problem may be date('d/m/Y',...), but how can I fix this?

1 answer

2


You can do the following:

$segunda = date('d/m/Y', strtotime('monday this week'));  // 15/10/2018
$sexta = date('d/m/Y', strtotime('friday this week'));  // 19/10/2018
  • 1

    Anderson ball show. Thank you very much!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.