Re: Get Hours/Mins/Secs between two timestamps?

From: Date: Wed, 12 Dec 2001 12:28:27 +0000
Subject: Re: Get Hours/Mins/Secs between two timestamps?
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-77427@lists.php.net to get a copy of this message
> Since you asked, i guess you're not familiary with the % operator > (modulus). Read the operator section of the manual, and you'll see how > modulus is your friend... Wrong I use the % operator all the time > But a better way, is to subtract one from the other and then use > gmdate() on the difference, that way you don't have to worry about > differences in excess of 60 secs... and what if the difference between timestamp1 and timestamp2 is > 86400 ? -- Jon Farmer Systems Programmer, Entanet www.enta.net Tel 01952 428969 Mob 07763 620378 PGP Key available, send email with subject: Send PGP Key ----- Original Message ----- From: "Andreas Landmark" <andreas.landmark@noxtension.com> To: <php-general@lists.php.net> Sent: Wednesday, December 12, 2001 11:34 AM Subject: Re: [PHP] Get Hours/Mins/Secs between two timestamps? > On Wed, Dec 12, 2001 at 11:31:25AM -0000, Jon Farmer wrote: > > >Is there a function in PHP that will output the difference between two > > timestamps (hours/mins/secs), similar in >the way that getdate() extracts > > the date of a timestamp? Thank you. > > > > > > How about subtracting the one timestamp from the other and then devide by > > 3600, with the remainder divided by 60 and the remainder is your seconds. > > > > > -- > Andreas D Landmark / noXtension > Time flies like an arrow, but fruit flies like a banana. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#77427) next »