Nice but there is only one problem...
I don't think that your two dates have exactly the same hour, minute and
second...
So you will eighter have to set them to 0 on both dates before subbing
them...
Or you simply say sub only to take the date in accout with it's second
parameter.
Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com
----- Original Message -----
From: "debussy007" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, November 11, 2008 7:33 PM
Subject: Re: [fw-general] Get the interval in days of two dates
Hi,
I tried the following:
$currentDate = new Zend_Date();
$date = new Zend_Date('2009-04-19', 'yyyy-MM-dd');
echo $currentDate->get('yyyy-MM-dd');
echo '<br>';
echo $date->get('yyyy-MM-dd');
echo '<br>';
echo $date->sub($currentDate)/60/60/24;
I get the following result:
2008-11-11
2009-04-19
158.14543981481
Did I do something wrong ?
Thank you for your kind help!
thomasW wrote:
$date1->sub($date2);
Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com
----- Original Message -----
From: "debussy007" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, November 11, 2008 3:12 PM
Subject: [fw-general] Get the interval in days of two dates
Hi,
I need to get the interval in days of two dates:
$date = new Zend_Date($advert['expired_date'], 'yyyy-MM-dd HH:mm:ss');
$currentDate = new Zend_Date();
I can then display something like:
Your advert will expire in x days.
Can anyone help me with this ?
Thank you for any kind help !
--
View this message in context:
http://www.nabble.com/Get-the-interval-in-days-of-two-dates-tp20440319p20440319.html
Sent from the Zend Framework mailing list archive at Nabble.com.
--
View this message in context:
http://www.nabble.com/Get-the-interval-in-days-of-two-dates-tp20440319p20445543.html
Sent from the Zend Framework mailing list archive at Nabble.com.