Answer the question
In order to leave comments, you need to log in
How to display the days of Monday and Sunday of a certain amount of the week?
How to make it so that, for example, you indicate the 13th week, which is now going on, it outputs 26.03 - 1.06
. You indicate the 11th week, then it indicated 12.03 - 18.03, Well, accordingly, if the 6th week, then 5 - 11.02.
But with this approach
<?= date('d.m', strtotime('13 week last Monday')).' - '.date('d.m' , strtotime('13 week Sunday')) ?>
Answer the question
In order to leave comments, you need to log in
The parser is very ambiguous ...
But in your case, you can put it like this
$date_start = new DateTimeImmutable('13 week first monday of Jan this year - 1 week');
$date_end = $date_start->modify('+6 days');
echo $date_start->format('d.m') .' - '. $date_end->format('d.m');
// 26.03 - 01.04
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question