Код: Выделить всё
$date = '2025-07-31';
$month_1 = (new DateTime($date))->modify('-2 month')->format('Y-m');
$month_2 = (new DateTime($date))->modify('-3 month')->format('Y-m');
print_r($month_1); // output -> 2025-05
print_r($month_2); // output -> 2025-05
Код: Выделить всё
$month_1Подробнее здесь: https://stackoverflow.com/questions/797 ... ime-in-php
Мобильная версия