i am using zend framework and i want to know the hour difference between 2 dates.
I know how to do it in core php using strtotime.
But i want it in Zend, if at all possible.
Ex: These are my dates in datetime format:
2011-04-13 23:00:00
2011-04-14 15:45:00
It seems there is a
sub()method inZend_Date:Using
Zend_Date::HOURas $part should do the trick, I suppose :As a sidenote : when working with
strtotime(), dates are reprensented using UNIX Timestamps — which can only go from 1970 to 2038 (on 32 bits systems, at least)It would probably wiser to work with the
DateTimeclass, which allows one to manipulate a (virtually) unlimited range of dates.