我在变量“$ date”中输入日期,现在我想计算从$ date到12周后的日期,我怎么能用php.i编写下面的php代码,但是它的nt working.can任何人都说出解决方案
$month = 2;
$year = 2012;
$date = date('Y/M/d',strtotime('First Saturday '.date('F o', @mktime(0,0,0, $month, 1, $year))));
echo $date;
echo "<br/>";
$newdate = strtotime ( '+12 week' , strtotime ( $date ) ) ;
$newdate = date ( 'Y-m-j' , $newdate );
echo $newdate;
答案 0 :(得分:0)
试试希望它有所帮助
$newdate = strtotime(date("Y-m-d", strtotime($date)) . " +12 week");
答案 1 :(得分:-1)
$month = 2;
$year = 2012;
$date = date('Y/M/d',strtotime('First Saturday '.date('F o', @mktime(0,0,0, $month, 1, $year))));
echo $date;
echo "<br/>";
$newdate = strtotime ( strtotime ( $date ) . '+12 week' ) ;
$newdate = date ( 'Y/M/d' , $newdate );
echo $newdate;
这应该是你要找的东西