php - strotime with a difference of 20 months -
php - strotime with a difference of 20 months -
i seek create new date strotime difference of 20 months, if set "+20 months" or "+1 year 10 months" first argument doesn't work.
but if set "+2 years" work, guess m not far after reading documentation on php.net m not able create work.
my code:
$today = date("y-m-d"); $expire = $res['expire']; //$newdate = strtotime ( '+20 months' , strtotime ( $expire ) ) ; //not ok $newdate = strtotime ( '+2 years' , strtotime ( $expire ) ) ; //ok
thanks help
$expire = "2014-6-19"; $newdate=strtotime ( '+20 months' , strtotime ( $expire )); echo date("y-m-d",$newdate); //2016-02-19
that seems work fine. that's date after 20 months. what's format of date contained in $expire
?
php strtotime
Comments
Post a Comment