in zend and php i wrote one small function which is used for adding days,months and year to a date and Format is YYY-MM-dd
Zend
$date = new Zend_Date();
$disbursedDate1='2010-03-11';
$date->set($disbursedDate1,Zend_Date::DATES);
$disbursedDate1=$date->toString("YYY-MM-dd");
$date->set($disbursedDate1,Zend_Date::DATES);
$disbursedDate1=$date->toString("YYY-MM-dd");
$cd = $this->add_dateAction($disbursedDate1,0,1,0);
echo $cd;
Php
$disbursedDate1='2010-03-11';
$cd = $this->add_dateAction($disbursedDate1,0,1,0);
echo $cd;
Function
function add_dateAction($givendate,$day=0,$mth=0,$yr=0)
{
$cd = strtotime($givendate);
$newdate = date('Y-m-d', mktime(date('h',$cd),
date('i',$cd), date('s',$cd), date('m',$cd)+$mth,
date('d',$cd)+$day, date('Y',$cd)+$yr));
return $newdate;
}
Note:- in zend formate is changed so i used this function to over that prob
in Zend default formate is YYYY-DD-MM ,but we can change what every formate we want by Zend_Local
No comments:
Post a Comment