Final date in D / M / A, on a certain number of days [duplicated]

0

I need the function to compute and display in the format (DD / MM / YYYY) the final day by adding the days received starting today.

    
asked by anonymous 09.03.2016 / 22:28

2 answers

1

The way I use it:

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

Read more about functions in documentation:

Hope it helps, hugs.

    
09.03.2016 / 22:33
1

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

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