# Convert seconds to hours, minutes and seconds

How do I convert seconds to hours, minutes, and seconds

Have a look at

1 Like
1 Like

If you want to avoid extensions, use the math blocks for quotient and remainder.
Divide by these factors, working down from largest to smallest:

• The number of seconds in an hour
• The number of seconds in a minute

Show the quotient, and pass the remainder to the next division step.

To force 2 digits, add 100 and clip off the leading '1'.

1 Like

Yeah,

``````Hours  = Quotient of seconds by 3600
Minutes  = (Remainder of seconds by 3600)/60
Seconds = Remainder of seconds by 60
``````

P.S. If we are not having any regrence time, I think we can go with average days in months, and calculate months and years from given seconds, i.e., 30.437

An easier way of doing it with variables:

an endless loop will result in a runtime error after a while
The model of event processing in App Inventor by Lyn
also as far as I can see, you will get a very large result for the hours, becuse you are counting the number of hours starting from Jan 1st, 1970

Taifun