February, 2011

24
Feb 11

Add or remove days or dates in PHP

I you know PHP, you know this:

$date = date("Y-m-j");
$date = strtotime ('-4 days', strtotime($date) ) ;
$date = date ('Y-m-j' , $date1);

In the above example I’m subtracting 4 days from current date.

Now, if you want to change the format represented above:

$date = date("j/M/Y", strtotime($date));