Saturday, February 19

Getting FUTURE Dates in PHP

I came across this problem wherein, given a date, i had to get the next date depending on the number of days specified. For example, if the date is "17-02-2011", i had to find out what would be the date after 90 days from this given date. After searching online, and looking up in, i got this solution.

    $date = "17-02-2011";
    //get the date after 90 days
    $enddate = strtotime("$date + 90 days");
    echo $enddate = date("d-m-Y",$enddate);

//Output is 18-05-2011

Be the first one to Comment!!!

Post a Comment