Why software wants milliseconds
Many programming interfaces take time in milliseconds: JavaScript timers, HTTP client timeouts, session expiries, cache lifetimes and video player seek positions. People who set them think in hours. A session that should last 2 hours has to be entered as 7,200,000, and a cache that should expire after 24 hours as 86,400,000. This page performs that multiplication and the reverse, so that a configuration value can be checked at a glance and a pasted number from a log can be read back as hours. Developers who write the multiplication inline, such as 2 * 60 * 60 * 1000, get the same answer, and the page is a quick way to confirm that the constant in a pull request matches the intent in its comment. Product managers can use it too when a spec says that a link should stay valid for 6 hours and the engineer asks for the number.
The factor
An hour contains 3,600 seconds, and a millisecond is 10 to the power of minus 3 second, so there are 1,000 milliseconds per second. Multiplying gives 3,600 × 1,000 = 3,600,000 ms per hour. The hour is accepted for use with the SI by the BIPM, and the millisecond is the SI second with the prefix milli. The default of 10 hours therefore gives 36,000,000 ms, thirty-six million, which is easy to check by counting three zeros for the prefix and then the 3,600. Fractions of an hour work the same way: 0.25 hour is 900,000 ms, 0.1 hour is 360,000 ms and 1 minute, one sixtieth of an hour, is 60,000 ms. Writing out the chain hours to minutes to seconds to milliseconds is a good habit when you review code, because each factor of 60 or 1,000 is visible and a missing one stands out.
Common settings in milliseconds
A 30 minute session timeout is 1,800,000 ms, a 45 minute lesson 2,700,000 ms, a 1.5 hour film 5,400,000 ms and a 3.5 hour shift 12,600,000 ms. A day of cache lifetime is 86,400,000 ms and a quarter of an hour 900,000 ms. If you are entering these into a configuration file, a missing zero changes the duration tenfold, so a quick conversion before saving prevents the surprise of a session that ends after 18 minutes when you wanted three hours. Password reset links, one-time download links and trial periods follow the same pattern: 15 minutes is 900,000 ms, 6 hours is 21,600,000 ms and 72 hours is 259,200,000 ms. Some frameworks ask for seconds and others for milliseconds, so check which one a setting expects before you paste the number, because a value that is 1,000 times too large silently turns a six-hour session into one that lasts about 250 days.
The 2,147,483,647 limit
Some systems store milliseconds in a signed 32-bit integer, whose largest value is 2,147,483,647. Divided by 3,600,000 that is about 596.5 hours, or 24.86 days. JavaScript timers in many browsers and runtimes fail or fire immediately when given a delay above that value, which catches people who try to schedule something a month ahead with a single timer. Converting your intended wait into milliseconds and comparing it with this limit tells you whether to split the wait into shorter steps. A common pattern is a timer that fires every hour and checks the date, which keeps each delay at 3,600,000 ms and well under the limit. Another is storing the target date and comparing it on a short interval, which survives a restart of the program.
Video editing and timelines
Editors and subtitle tools use millisecond timestamps. A 1.5 hour recording has 5,400,000 ms of material, and a frame at 60 frames per second lasts about 16.67 ms. An hour of footage holds 216,000 frames at 60 fps, which comes from 3,600 seconds times 60. Subtitle formats often show hours, minutes, seconds and milliseconds separately, so converting an offset of 12,345,678 ms gives about 3.43 hours, or 3 hours, 25 minutes and 45.7 seconds. The converter handles the whole-hour conversion and you can split the remainder by hand. Broadcast and film work also lean on milliseconds when syncing audio: a lip-sync error of 40 ms is noticeable to viewers, and over a two-hour film, which is 7,200,000 ms long, a drift of 0.5 percent amounts to 36,000 ms, or 36 seconds, which is why long recordings need a stable clock.
Games, apps and performance
Frame budgets, cooldowns and animation lengths are in milliseconds, while event schedules and play sessions run in hours. A game that grants a reward every 4 hours has a 14,400,000 ms cooldown. A frame budget of 16.67 ms at 60 fps shows how little time each update gets. A one-hour stress test of an app that handles one action every 250 ms performs 14,400 actions. These examples are illustrative, but the arithmetic is the same each time: hours times 3,600,000 gives milliseconds. A mobile game that refills energy every 30 minutes and caps the bar at 5 refills needs 9,000,000 ms to fill from empty, and the designer can read that back as 2.5 hours when testing the pacing.
Reading milliseconds as hours
To read a large millisecond value, divide by 3,600,000. A log entry of 10,800,000 ms is 3 hours. A value of 500 ms is about 0.000139 hours, which is useless in hours, so keep short durations in seconds or milliseconds and use hours for long ones. A mixed format such as 2 hours 15 minutes helps readers, and the page output can be turned into it by taking the whole hours and multiplying the fraction by 60. For example, 8,100,000 ms is 2.25 hours, which is 2 hours and 15 minutes, since 0.25 times 60 is 15.
Mistakes to avoid
The common errors are using 1,000 instead of 3,600 per hour in the conversion, forgetting that a minute is 60 seconds, and mixing up milliseconds and microseconds, which differ by 1,000. Treat a day as 24 hours only for elapsed time, since calendar days change length at daylight saving boundaries. A timer set in milliseconds counts elapsed time and is not affected by the clock change, but a date calculation might be.
Choosing a sensible timeout in milliseconds
The converter changes a duration from hours to milliseconds. It does not tell you what timeout is sensible for a service, how accurate a timer is, or whether a system supports a given range. Timers drift and runtimes may clamp values. Check the documentation of the tool in use for limits and behavior, and test in the environment where the value will run.