Durations that live in seconds

Software and equipment often store a duration as a plain count of seconds: a cache lifetime, a session expiry, a certificate validity period, a retention setting for backups, the uptime of a server or the running time of a machine. A person who has to explain such a setting to a colleague or a customer wants days. This page divides the seconds value by 86,400 and returns days, using a fixed day of 24 hours. The selector also offers minutes, hours, weeks, milliseconds, microseconds and nanoseconds, so a long span can be shown in several units on the way to the most readable one.

Where 86,400 comes from

A day of 24 hours holds 24 × 60 × 60 = 86,400 seconds, and the formula is d = s × 0.0000115740740741. The second is the SI base unit of time, while the day is a non-SI unit accepted for use with the SI, as the SI Brochure notes, and it is defined as 86,400 s for these purposes. By hand, divide by 86,400, or divide by 864 and shift two places. A count of 172,800 s is 2 days, 604,800 s is 7 days, and 2,592,000 s is 30 days. Memorizing 86,400 and 3,600 covers most conversions between seconds, hours and days.

Ten seconds as a fraction of a day

The default of 10 seconds returns about 0.00011574 day. The number is tiny because a day is long, and it is rarely the figure you would quote for such a short period. For a short span, the natural unit is the second or the minute, and days enter when the count is in the tens of thousands or more. A rule of thumb is that 100,000 seconds is a little over a day, 1.157 days to be precise. If you enter a short duration and the result looks like zero, the page is correct; choose minutes or hours as the target to get a number with a useful size.

Token and cache lifetimes in days

Web developers set expiry values in seconds. A time-to-live of 86,400 means one day, 604,800 means a week and 2,592,000 means 30 days. A value of 7,776,000 equals 90 days, a typical length for some certificates. Reading those settings in days helps in reviews, because a mistyped digit changes a week into a day or into several months. The page also works backward: 3 days equal 259,200 seconds and half a day equals 43,200 seconds. When you paste a value into a configuration file, confirm which unit the system expects, since some use seconds, some milliseconds and some minutes. A cookie that should last 14 days needs 1,209,600 seconds, and typing 14 in a seconds field gives a cookie that expires in 14 seconds, a surprisingly common bug.

Odd counts and the remainder

A count such as 1,000,000 seconds equals 11.574 days, and the decimal part is not a number of hours. To read it as days, hours and minutes, take the whole days, 11, then multiply the remainder 0.574 by 24 to get 13.8 hours, and so on. The result is 11 days, 13 hours, 46 minutes and 40 seconds. People often read 11.574 days as 11 days and 57 hours by mistake. If the answer must be shown as a clock-style value, convert the fractional day to hours separately, and use whole numbers at each stage so the display matches common usage.

Uptime, runtime and maintenance logs

A server that reports an uptime of 3,456,000 seconds has been up for 40 days. A machine with an hour meter in seconds can be compared with a service interval written in days. The conversion is straightforward when the machine ran continuously, but the day count of a duty cycle can mislead if the device sleeps part of the time, since seconds of operation and calendar days are different quantities. The page changes the unit of the count you enter and cannot know whether the count covers wall-clock time or running time, so label the source of the figure in your report. A pump with 5,000,000 seconds on its run counter has run 57.87 days in total, which is about 1,389 hours, and a maintenance interval written in hours is better read against the hour count than against calendar days.

Calendar days are not always 86,400 seconds

The conversion treats a day as exactly 86,400 seconds. On a calendar, a day that includes a daylight saving change has 23 or 25 hours in a local time zone, and a leap second has occasionally made a day 86,401 seconds long in UTC. Unix timestamps ignore leap seconds by definition and count 86,400 seconds in every day. For a retention rule that must match calendar dates, a count of days in the calendar is more reliable than a count of seconds. The page is right for elapsed time and not for calendar arithmetic across time zone changes. A backup job that must keep copies for 14 calendar days is safest expressed as a number of days in the scheduler, while 1,209,600 seconds is the matching elapsed-time figure if the system only accepts seconds.

Weeks, months and years

The selector includes weeks, so 604,800 seconds is one week and 1,209,600 is two. It does not offer months or years, since those vary in length: a month holds 28 to 31 days, and a year holds 365 or 366. A common approximation is 30 days for a month, which is 2,592,000 seconds, and 365 days for a year, which is 31,536,000 seconds. State the approximation in any document that uses it. For billing and legal terms, use the calendar definition that applies, because a difference of one or two days can matter when a deadline or a fee depends on it.

Checking a result

Sanity checks make errors visible. The result in days should be about one eighty-six-thousandth of the input in seconds, so a result with the same digits as the input, with only the exponent changed by five places, is plausible. If you converted from milliseconds by mistake, the answer is off by a factor of 1,000. Test one reference value before a long list: 86,400 must return 1. Round the output to the precision of the source, because a count of seconds known to the nearest hour does not justify five decimal places of a day.