The programmer's unit of time

Milliseconds are the default time unit in many programming environments. JavaScript's Date and setTimeout, Java's System.currentTimeMillis, and the max-age and expiry settings of many caches and token libraries all take milliseconds. Humans describe the same settings in days: a session lasts 30 days, a cache entry for 7, a reminder 1 day ahead. Typing the right number of zeros is the problem. This page multiplies days by 86,400,000, so you can paste the answer into a configuration or a line of code. It treats a day as a fixed 24 hours and does not interpret calendar dates, time zones or daylight saving rules.

Deriving 86,400,000

A day has 24 hours, an hour has 60 minutes, and a minute has 60 seconds, which gives 86,400 seconds. The SI prefix milli is one thousandth, so 1 s is 1,000 ms, as the SI Brochure sets out. Multiplying 86,400 by 1,000 gives 86,400,000 ms per day, which programmers often write as 24 * 60 * 60 * 1000. Writing the product in code with its factors, rather than as a literal, makes the intent visible. The page gives the literal result for checking. A seven-digit-plus figure that starts with 864 is the signature of days in milliseconds, so a value starting with another digit string suggests a different input. Python sleep functions and many shell tools take seconds, and Go uses typed durations, so check the unit each API expects before pasting a number.

Ten days by default

The default of 10 days returns 864,000,000 ms. As a configuration value that is a ten-day lifetime, comfortably below the 32-bit limit of 2,147,483,647, so it fits in a signed 32-bit integer. Doubling it to 20 days gives 1,728,000,000, which still fits, but 30 days gives 2,592,000,000, which exceeds the signed 32-bit range. Whether that matters depends on the type your platform uses for time spans. Checking the largest value a field can hold is a routine step when converting durations in this unit, and the page helps by showing the size of the number. A 90-day lifetime would be 7,776,000,000 ms, more than three times the signed 32-bit limit.

A well-known limit near 24.8 days

Browsers and Node.js store the delay of setTimeout as a signed 32-bit integer, so the longest delay they honor is 2,147,483,647 ms. That equals 24.8551 days. A longer delay overflows and the timer fires almost immediately, a bug that surprises developers who schedule a 30-day timeout. Converting 30 days gives 2,592,000,000 ms, over the limit, whereas 24 days is 2,073,600,000 ms and fits. For longer intervals, programs reschedule in chunks or store an absolute deadline and check it periodically. The page makes the arithmetic of such limits quick, but the behavior of any given runtime comes from its documentation.

Date objects and their range

The ECMAScript specification defines time values as milliseconds since 1970-01-01 UTC and limits them to a magnitude of 8.64 × 10¹⁵ ms. Dividing by 86,400,000 gives exactly 100,000,000 days on either side of the epoch, which corresponds to roughly 273,790 years each way. Dates beyond that range are invalid. The figure explains why the specification chose a number of the form 100 million days, and it shows how the page factor connects day counts with the millisecond values that appear in code. Unix time in seconds uses a different unit, so check which one a value is in before converting.

Common values to keep at hand

A few conversions recur. One hour is 3,600,000 ms, one day 86,400,000 ms, and one week 604,800,000 ms. Thirty days is 2,592,000,000 ms. Half a day, 0.5, is 43,200,000 ms, and a quarter day is 21,600,000 ms. Authentication tokens often expire in a day or in 15 minutes, which is 900,000 ms. Entering days into the page and reading the milliseconds avoids the common mistake of writing 8,640,000 or 864,000,000 for one day by dropping or adding a zero. If a timeout seems to fire after 1.4 minutes or 14 hours instead of a day, that is the type of slip to look for. Two weeks, 14 days, is 1,209,600,000 ms.

Fixed days versus calendar days

A day here is exactly 24 hours of elapsed time. A calendar day in local time can be 23 or 25 hours on the dates when daylight saving begins or ends, and UTC days are occasionally 86,401 seconds when a leap second is inserted. Programs that need midnight-to-midnight behavior should use a date library instead of a fixed millisecond count. For lifetimes, such as how long a cached item stays valid, a fixed duration is usually what is wanted, and this page gives the right figure. Choose the model that matches the requirement, then document which one the setting uses. A rule such as every day at 09:00 local time needs a calendar-aware scheduler, since a fixed 86,400,000 ms interval drifts by an hour across a clock change.

Going back and checking

To read a millisecond setting in days, divide by 86,400,000. A value of 2,592,000,000 ms is 30 days, and 604,800,000 ms is 7 days. For the 32-bit limit, 2,147,483,647 ms returns 24.8551 days, and the page result matches that figure when you enter it in milliseconds and choose days. This reverse check is useful when reading code written by someone else, because a constant with many zeros hides its meaning. Writing the unit in the variable name, such as expiryMs, together with a short comment giving the days, keeps configuration readable for the next person. A reviewer who sees 1209600000 in a configuration file can divide by 86,400,000 to find 14 days, and the page performs that division when the units are swapped.

Timers, caches and library rounding

The conversion is a plain multiplication by a defined constant. It does not parse dates, add time zones, apply leap seconds, or check whether a platform can store the value. It cannot tell you whether a timer will fire, whether a cache honors the setting, or how a library rounds. Those depend on the software involved. If your result differs from another tool, check whether that tool assumed a different unit, or a calendar month or year instead of the fixed day count. It also cannot say whether a library measures a delay from the call or from the next scheduler tick, which is a runtime question.