Re: determining time difference between two timestamp fields.

From: Date: Tue, 25 May 2010 18:28:07 +0000
Subject: Re: determining time difference between two timestamp fields.
References: 1 2 3 4 5 6 7  Groups: php.general 
Request: Send a blank email to php-general+get-305515@lists.php.net to get a copy of this message
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

« previous php.general (#305515) next »