Ahhh - that works a treat! First time I've seen the floor command in action.
Thanks Jonathon. Still more lines of code than I'd like, but obviously its not that easy to do! Best Regards Bob Irwin Server Admin & Web Programmer Planet Netcom ----- Original Message ----- From: "Jonathan Sharp" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: "'Matt'" <[EMAIL PROTECTED]>; "'Bob Irwin'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, November 20, 2002 12:41 PM Subject: Re: [PHP] Seconds to minutes > i'll just throw my code in here while we're at it... > > $seconds = 3600*5 + (60 * 10) + 45; > > $hours = floor( $seconds / 3600 ); > $mins = floor( ($seconds % 3600) / 60 ); > $seconds = floor( ($seconds % 60) ); > > echo "Hours: $hours\nMins: $mins\nSeconds: $seconds\n"; > > -js > > > John W. Holmes wrote: > >>You can do something like this: > >><?php > >> $seconds = 265; > >> $time = date('i s',$seconds); > >> $minSecs = explode(' ',$time); > >> echo "{$minSecs[0]} minutes and {$minSecs[1]} seconds<br>\n"; > >>?> > > > > > > That doesn't work for anything over 3599 seconds, though... > > > > ---John Holmes... > > > > > > > > > > > Scanned by PeNiCillin http://safe-t-net.pnc.com.au/ > Scanned by PeNiCillin http://safe-t-net.pnc.com.au/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php