I am designing a software for leave management in php.I actually need a simple function in php which takes a given开发者_StackOverflow date as parameter(i.e any date) and no of days to be added to it as the parameter and returns the resultant date.
The function should accept date in 'YYYY-MM-DD' format and also return resulting date in same mentioned format.
I need help.Any help will be highly appreciated in this regard.
As simple as:
echo date('Y-m-d', strtotime('2011-05-12') + (60 * 60 * 24 * $days));
or:
echo date('Y-m-d', strtotime("+$days days", strtotime('2011-05-12')));
精彩评论