开发者

Get the date of the next occurrence of the 18th

Okay, so I need to use PHP to obtain the date of the next occurrence of the 18th.

For example, let's say I ran my script on Dec. 28th, 2011. I would need some code that would be able to spit out 2012-开发者_JAVA技巧01-18. If it were April 9th, 2011, I would need the code to spit out 2011-04-18. Make sense?

Any ideas?


This should give you the next occurrence of the 18th

$nextDay = 18;
$nextDate = (date('d') > $nextDay) ? date('Y-m', strtotime('+1 month')).'-'.$nextDay : date('Y-m').'-'.$nextDay;
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜