Re: determining time difference between two timestamp fields.

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

 



On Tue, 2010-05-25 at 14:22 -0400, Bruce Gilbert wrote:
> echo "<tr><th>Completion Time:</th></tr><tr><td>". date('F j, Y
> g:i:sa',strtotime($row['submit_timestamp']) -
> strtotime($row['login_timestamp']))/60 , "</td></tr>";

There's a good reason for that! What you're actually doing is this:

echo "<tr><th>Completion Time:</th></tr><tr><td>" .
  date('F j, Y g:i:sa',
    strtotime($row['submit_timestamp']) -
    strtotime($row['login_timestamp'])
  )
  / 60
  , "</td></tr>";

You're trying to divide a string by 60, because date() returns a string.
Put that division inside the brackets for date() rather than outside.

It might help to break up that whole line of output into several parts.
Put the date into a variable and then just output the HTML line:

$date = date('F j, Y g:i:sa', (strtotime($row['submit_timestamp']) -
strtotime($row['login_timestamp']))/60);
echo "<tr><th>Completion Time:</th></tr><tr><td>$date</td></tr>";


Thanks,
Ash
http://www.ashleysheridan.co.uk




-- 
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