How to convert value to hours, minutes & remaining seconds

I am building count down timer so want to convert value to hours minutes & remaining seconds

for example value = 82369

What units is the example value in ?

  • seconds ?
  • milliseconds ?
  • something else ?

value can be milliseconds or seconds

Let's suppose that it is milliseconds

How many milliseconds are there in a second ?

sure , each 1 second equal 1000 milliseconds

but want to exchange any value to four variables as hour, minute, second, millisecond

If you subtract the (start value / 1000) from the start value you will know how many whole seconds there are

How many seconds are there in a minute ?
Can you see the way that this is going ?

If you don't want to work it out for yourself then a search of the forum or Google could be useful

1 Like

do it, thanks

value = 82369:
h=value /60/60;
m=(value/60)%60;
s=value %60;

It would be correct if the value was in seconds. But it is not....

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.