S
S
stepan-neretin72019-07-14 19:30:25
PHP
stepan-neretin7, 2019-07-14 19:30:25

How to display next Monday?

I need to display the next Monday - next or previous, depending on who is closer.
Tell me how to do it.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Nikolaev, 2019-07-14
@Heian

$date = new \DateTime('Monday next week');
echo $date->format('Y-m-d');

https://www.php.net/manual/en/datetime.formats.rel...

A
Andrey Suha, 2019-07-14
@andreysuha

echo "ближайший понедельник"
Here's what I 'll leave
Z.y. take date N and compare if less equals 3 previous if greater equals 5 next if 4 decide yourself

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question