Saturday, May 24, 2008

Add Days in PHP Date,

<?


$edate = date('Y/m/d');


$ndate = adddays( $edate,1);

$pdate1 = adddays( $edate,-1);




function adddays($date,$days){

$rs = $this->execute("select DATE_FORMAT(DATE_ADD('$date',INTERVAL $days DAY),'%Y-%m-%d') as newdate");

if($row = $this->row($rs)){

return $row["newdate"];

}else{

return "0000-00-00";

}

}


?>

No comments: