Re: Question about date calculations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/29/2011 01:22 PM, Eric Lommatsch wrote:
Hello List,

I am using PHP version 5.2.6.

I am using PHP V5.3.3

In my setup, the following lines give me errors stating that PHP cannot convert the DateTime object to a string. I was able to get around the error by changing your code to the following.

   $intDayCnt=$dteEndDate[$i]-$dteStartDate[$i];

$intDayCnt = ( $dteEndDate[$i]->format('m') -
               $dteStartDate[$i]->format('m') );

Be sure to change the following line as well.
$dteCheckDate = date('U');

   if (($dteCheckDate>=($dteEndDate[$i]-7)&&
$dteCheckDate<=($dteEndDate[$i]+1))&&  $intDayCnt<16)

if (
     $dteCheckDate >= ( $dteEndDate[$i]->format('U') - (7*86400) )
     &&
     $dteCheckDate <= ( $dteEndDate[$i]->format('U') + (86400) )
     &&
     $intDayCnt < 16
   ) {

Eric Lommatsch.

--
Jim Lucas

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux