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

Php - Delimiter must not be alphanumeric or backslash -

c# - How to change the "Applies To" field under folder auditing options programatically (.NET) -

c++ - Ambiguity when using boost::assign::list_of to construct a std::vector -