Wednesday, December 17, 2014

datetime - How to Minus & pluse two dates in php

Standard

How do I return the  date as pulse & Minus?

add days


 
                    $date=date_create(date("Y-m-d"));
                    date_add($date,date_interval_create_from_date_string("10 days"));
                    echo date_format($date,"Y-m-d"); 
Minus days
 
                   $mydate = date("Y-m-d");

$lastday = strtotime("-1 days", strtotime($mydate));

echo date("Y-m-d", $lastday);

0 comments:

Post a Comment