开发者

php date manipulation [closed]

开发者 https://www.devze.com 2023-03-05 02:33 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

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')));
0

精彩评论

暂无评论...
验证码 换一张
取 消