Answer the question
In order to leave comments, you need to log in
How to add several days (days) to a date with an accuracy of up to a minute?
There is a string with a date and time, you need to add a few days to it, but there is a problem with adding minutes.
$old_date = '2022-01-15 23:59:59';
$date = new DateTime($old_date);
$date->modify('+10 day');
$new_date = $date->format('Y-m-d H:m:s');
print($new_date);
// Выводит 2022-01-25 23:01:59
Answer the question
In order to leave comments, you need to log in
You instead of minutes deduced a month.
$new_date = $date->format('Y-m-d H:i:s');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question