views:

191

answers:

2

I have this code:

$date = '2010-03-08 8:10:20'
$new_date  = date('Y-m-d H:i:s', strtotime($date . " +1 month"));
echo $new_date;

Btw, I already set

date_default_timezone_set('Europe/London');

And the result is: 5 April 2010, 3 days missing. Why is it happen? I heard they are some bugs in strtotime? If thats the case, how to get a correct one? I mean, is there another way to replace this:

$new_date  = date('Y-m-d H:i:s', strtotime($date . " +1 month")); // or +2, +3... +100
A: 

I do this:

date_default_timezone_set('Europe/London');

$date = '2010-03-08 8:10:20';
$new_date  = date('Y-m-d H:i:s', strtotime($date . " +1 month"));
echo $new_date;

and get

2010-04-08 08:10:20

so you've got some other issue.

cletus
A: 

Use mktime Function :

$date = date ( 'Y-m-d H:i:s', mktime ( arguments ) + one_month_epoch_value) ) ; 
pavun_cool