+ -
当前位置:首页 → 问答吧 → 第二题

第二题

时间:2008-10-11

来源:互联网

int strtotime ( string time [, int now] )
<?php

function getYourDate($yourNowDate,$days=0){

list($year,$month,$day) = split('-',$yourNowDate);

$yourNowDate=mktime(0,0,0,$month,$day,$year);

$date=strtotime($days." days",$yourNowDate);

return date('Y-m-d',$date);

}

$yourDate=getYourDate('2008-09-25',-6);

echo $yourDate.'<br />';
?>
原来这样也可以:

<?php
/*author:thankwsx*/
function addday($date,$day){

return date('Y-m-d',strtotime($date ." +".$day." days"));
}
echo addday('2008-09-25',-6);
?>

作者: benben3221987   发布时间: 2008-10-11