datetime - Adding days to date in php -


i read not working me. here code:

$today = date_create()->format("d/m/y"); // today 25/04/2013 $num_days = getnumberofdays(); $end_date = date("d/m/y", strtotime($today . " + $num_days days"));  

the value $end_date 31/12/1969. doing wrong?

from looks you're trying do, don't need $today (as defaults if date not supplied), eg:

 $end_date = date("d/m/y", strtotime("+ 5 days"));   echo $end_date; 

result be

 30/04/2013 

if want provide date, need parameters other way round, per the manual:

strtotime ( string $time [, int $now = time() ] ) 

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -