Re: Seconds to minutes

From: Date: Wed, 20 Nov 2002 01:16:09 +0000
Subject: Re: Seconds to minutes
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-125173@lists.php.net to get a copy of this message
Its seems far more reliable than what I am using (dividing by 60 for minutes, 3600 for hours and doing rounding, exploding if its not a round number etc). Its only for measuring short times, so Matt's suggestion should work ok. Ideally though, because it will crop up from time to time, it'd be the go to do it right the first time. Anyone else know of a better way? Best Regards Bob Irwin Server Admin & Web Programmer Planet Netcom ----- Original Message ----- From: "John W. Holmes" <holmes072000@charter.net> To: "'Matt'" <mschroebel@epooch.com>; "'Bob Irwin'" <bob@staff.pnc.com.au>; <php-general@lists.php.net> Sent: Wednesday, November 20, 2002 12:09 PM Subject: RE: [PHP] Seconds to minutes > > 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... > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > Scanned by PeNiCillin http://safe-t-net.pnc.com.au/ > > Scanned by PeNiCillin http://safe-t-net.pnc.com.au/ > Scanned by PeNiCillin http://safe-t-net.pnc.com.au/

« previous php.general (#125173) next »