parseguy
parseguy

Reputation: 129

javascript hours to real hours

I have a piece of code like this:

window.setInterval("reloadIFrame();", 3000);
                                        ^
                                        *

I want to know if there is a chart anywhere that can translate js time (*) to real hours, like one hour 2 hour three hour is there any way?

Upvotes: 0

Views: 72

Answers (2)

myselfmiqdad
myselfmiqdad

Reputation: 2606

The parameter does not accept hours, you would have to multiply to get it in millisecond.

1000 ms = 1 second
60 seconds = 1 minute
60 minutes = 1 hour

2 hours -> 60 min * 2 hours = 120 minutes * 60 = 7,200 seconds * 1000 = 7,200,000 ms

The reverse would be a division.

3000 ms / 1000 = 3 seconds / 60  = 0.05 minute / 60 = 0.00083 hours

Upvotes: 2

arcyqwerty
arcyqwerty

Reputation: 10685

That 3000 is just expressed in milliseconds, so standard math will do.

3000ms = 3000ms / 1000ms/s / 3600s/h = .00083 hours

Upvotes: 3

Related Questions