あなたは使用することができstrtotime()
ますt
:
$x = 5; // given day
if(date('t') < $x){ // check if last day of the month is lower then given day
$x = date('t'); // if yes, modify $x to last day of the month
}
$month = date('m'); // current month
if(date('d') >= $x){ // if $x day is now or has passed
$month = $month+1; // increase month by 1
}
$year = date('Y'); // current year
if($month > 12){ // if $month is greater than 12 as a result from previous if
$year = date('Y')+1; // increase year
$month = 1; // set month to January
}
if(date('t', strtotime($year.'-'.$month.'-01')) < $x){ // check if last day of the new month is lower then given day
$x = date('t', strtotime($year.'-'.$month.'-01')); // if yes, modify $x to last day of the new month
}
$date = date('d F Y', strtotime($year.'-'.$month.'-'.$x));
// 05 November 2012
HEREは素晴らしいチュートリアルです。