function datadd($n, $date){
return date("Y-m-d H:i:s", strtotime($date ." +$n day"));
}
上面是单独加减"天"的,下面是可以加减年月周日时分秒的...
function datadd($part, $n, $date){
switch($part){
case "y" : $val = date("Y-m-d H:i:s", strtotime($date ." +$n year")); break;
case "m" : $val = date("Y-m-d H:i:s", strtotime($date ." +$n month")); break;
case "w" : $val = date("Y-m-d H:i:s", strtotime($date ." +$n week")); break;
case "d" : $val = date("Y-m-d H:i:s", strtotime($date ." +$n day")); break;
case "h" : $val = date("Y-m-d H:i:s", strtotime($date ." +$n hour")); break;
case "n" : $val = date("Y-m-d H:i:s", strtotime($date ." +$n minute")); break;
case "s" : $val = date("Y-m-d H:i:s", strtotime($date ." +$n second")); break;
}
return $val;
}
至于表单比较比较简单就自己写吧...