Re: Seconds to minutes

From: Date: Wed, 20 Nov 2002 01:41:57 +0000
Subject: Re: Seconds to minutes
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-125178@lists.php.net to get a copy of this message
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... > > >

« previous php.general (#125178) next »