Final date in D/M/A on a given number of days

Asked

Viewed 47 times

0

I need that when the user enters a number of days, the function should calculate and display in the format (DD/MM/YYYY) the final day summing the days received from today.

2 answers

1


Follow the way I use:

$qtdeDias = 5;
echo strftime('%d/%m/%Y', mktime(0, 0, 0, date('m'), (date('d')+$qtdeDias), date('Y')));

Read more about the functions in the documentation:

I hope it helps, hugs.

1

If you want to calculate the date, disregarding the timetable, an alternative (from the PHP 5.1) is to use the flexibility of strtotime().

$qtde = 46;
echo date("d/m/Y", strtotime("today midnight +$qtde days"));

Browser other questions tagged

You are not signed in. Login or sign up in order to post.