Home

Welcome to OnlineConversion.com

Formula for converting Seconds to hh:mm:ss
 

Formula for converting Seconds to hh:mm:ss
by Douglas Mitchell on 06/16/04 at 14:10:18

What is the formula for converting seconds to hh:mm:ss (I'll be using MDX)?

example: 132 seconds = 2 minutes and 12 seconds (132 seconds = 00:02:12).


Re: Formula for converting Seconds to hh:mm:ss
by Robert Fogt on 06/16/04 at 19:27:48

The formula I use on the site here is not really a formula, but the built in Date function of JavaScript.

Mostly a function would deal with dividing by 60.  Something like:

[pre]
if (seconds >= 60)
 {
 minutes = (int) seconds / 60;
 seconds -= (minutes * 60);
 if (minutes >= 60)
   {
     hours = (int) minutes / 60;
     minutes -= (hours * 60);
   }
 }
[/pre]

Thats off the top of my head.  There is bound to be an easier method.


Go Back | Archive Index


 

Did you find us useful?

Please consider supporting the site with a small donation.

click here for more information

 


BookMark Us

It may come in handy.

Check out our Conversion Software for Windows.

Can't find something?
Try searching.

Are you bored?
Try the Fun Stuff.

Was this site helpful?
Link to Us | Donate