Find the date for next 15th using php
I am trying to find the date when it's next 15th. I came across this Get the date of the next occurrence of the 18th but this s开发者_开发问答hows the today date if its' 18th..I want to see August 18th 20111.
Is there any way to get the next 15th?
regards
// dynamic typing FTW
$next15th = mktime(0, 0, 0, date('n') + (date('j') >= 15), 15);
echo date('Y-m-d', $next15th);
Looking at the link you provided above, I would assume you change the following:
$nextDay = 18;
I'd change that to:
$nextDay = 15;
if(date('d') >= 15)
$date = date('Y-m', strtotime('+1 month')).-'.$nextDay
else
$date = date('Y-m').'-'.$nextDay;
精彩评论