Как получить дату субботы конкретной недели, если неделя начинается не с понедельника?Php

Кемеровские программисты php общаются здесь
Ответить
Гость
 Как получить дату субботы конкретной недели, если неделя начинается не с понедельника?

Сообщение Гость »


As the title says, I'd like to get in PHP last week's Saturday date and current week's Saturday date with the constraint of a week starting with Saturday instead of Monday.

I first used strtotime('saturday last week') and strtotime('saturday this week') or new DateTime("saturday last week") and new DateTime("saturday this week") but it obviously doesn't give the expected result as the week starts with Monday.

So for example, if today is 2024-03-04, the result should be :
  • last Saturday: 2024-02-24
  • this Saturday: 2024-03-02

What would be the simplest way to do that?

EDIT: To make it simple, I'm trying to get the first day of the current and previous week for weeks that start with Saturday.


Источник: https://stackoverflow.com/questions/781 ... ith-monday
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Php»