I keep having trouble with this simple calculation! So, here is a little example to get the amount of days between now and the next occurance of July 1st.
//set up the 2 date objects$now = new Zend_Date();$next = new Zend_Date();//we want July 1st$next->setDay(1)->setMonth(7);//if we are currently after july this yearif ($now->get(Zend_Date::MONTH) >= 7) {//we need to work it out til next July$next->setYear($now->get(Zend_Date::YEAR) + 1);}else {//this july is fine$next->setYear($now->get(Zend_Date::YEAR));}$diff = $next->sub($now)->toValue();return $diff / 60 / 60 / 24;
with me the following worked:
floor( abs( Zend_Date1->toValue() – Zend_Date2->toValue() ) / 60 / 60 / 24 )