3 TOOLS TO EXPLORE

Time and timestamps in Date & time

Browse time and timestamps in date & time, page 1 of 1. This page includes Time Duration Calculator; Clock Time Difference Calculator.

Browse 3 subcategories

Three tools for three kinds of time arithmetic

Time arithmetic splits into durations, clock differences and machine timestamps, and this hub has one tool for each. The Time Duration Calculator takes two full timestamps, each with a date, a time and an explicit UTC offset, and returns the seconds elapsed between them. The Clock Time Difference Calculator takes two 24-hour times of day and returns the minutes between them, with a setting that says whether the end time falls on the next day. The Unix Timestamp Converter turns a count of seconds since a fixed origin into a UTC date and time. They look related because they all involve a clock, but the inputs are different, and so are the traps. A duration needs a start and an end that each pin down a moment, a clock difference needs you to say whether midnight is crossed, and a timestamp is tied to one reference moment and to UTC. Pick the tool that fits the data you have in front of you.

Durations: hours, minutes and decimal hours

The Time Duration Calculator subtracts one timestamp from another, so both ends need a date and an offset such as Z or -05:00. Its method converts each to seconds since the epoch, subtracts, and splits the signed result into days, hours, minutes and seconds. Because the offsets are explicit, a start of 2023-11-14T17:13:20-05:00 and an end of 2023-11-14T23:43:20Z compare correctly even though they are written in different zones. The common trouble afterward is the base. Hours and minutes use base 60, so 1 hour 45 minutes is 1.75 hours and not 1.45. Payroll and invoicing often want decimal hours, so 7 hours 30 minutes becomes 7.5, and 7 hours 20 minutes becomes 7.333 hours, which is usually rounded to 7.33. One day is 86,400 seconds, one hour is 3,600, and one week is 604,800. A negative result means the end comes before the start. Seconds must be 00 to 59, and leap seconds are not modeled.

Clock differences and crossing midnight

The difference between two clock times is straightforward when both fall on the same day. From 09:15 to 17:45 is 510 minutes, which is 8 hours 30 minutes, when the end is set to the same day. The Clock Time Difference Calculator asks you to state this, and its default is Next day, which adds 1,440 minutes. Leave that default on a same-day pair and 09:15 to 17:45 returns 1,950 minutes. In the other direction, choosing Same day when the end clock reads earlier than the start returns an error asking you to choose Next day. A shift from 22:00 to 06:30 with Next day selected lasts 510 minutes. Two clock times alone cannot show an interval longer than 24 hours, so if the span can exceed a day you need dates, which means the Time Duration Calculator. The tool reads 24-hour HH:MM input, so convert 12-hour times first: 12:00 a.m. is 00:00 and 12:00 p.m. is 12:00, and mixing them up produces a twelve-hour error that looks plausible.

Unix time: what the number means

A Unix timestamp counts the seconds elapsed since 1970-01-01 00:00:00 UTC, known as the epoch. It is a single integer, easy to store and compare, and it does not depend on a time zone because it refers to one global moment. The value 1,000,000,000 corresponds to 2001-09-09 01:46:40 UTC, and 1,700,000,000 falls on 2023-11-14 22:13:20 UTC. The Unix Timestamp Converter returns the UTC date and time for a number of seconds, and the supported range runs from year 0001 to year 9999. A timestamp of 0 is the epoch itself, and negative values are dates before 1970: minus 86,400 gives 1969-12-31T00:00:00Z. Unix time ignores leap seconds, so each day is treated as exactly 86,400 seconds and the count does not include the occasional extra second added to UTC. For most uses, that makes arithmetic simple, because subtracting two timestamps gives the elapsed seconds directly.

Seconds versus milliseconds

The most common timestamp error is a unit mismatch. Many systems, including JavaScript, store time in milliseconds since the epoch, giving a 13-digit number for current dates, while classic Unix tools use seconds, which gives 10 digits. The Unix Timestamp Converter expects whole seconds, and its supported range ends at 253,402,300,799, which is the last second of the year 9999. A 13-digit millisecond value exceeds that range and returns an error instead of a wrong date. Elsewhere, feeding milliseconds to a seconds parser can place the result tens of thousands of years in the future, and feeding seconds to a milliseconds parser gives a date in January 1970. A quick check is to count digits: 10 digits for seconds, 13 for milliseconds, 16 for microseconds, and 19 for nanoseconds in present-day values. Divide by 1,000 to move from milliseconds to seconds before using this page. Check the field in your data source to confirm its unit, instead of guessing from the size of the number.

Time zones, UTC and daylight saving time

A timestamp identifies a moment, and a readable date depends on the zone you display it in. The Unix Timestamp Converter shows UTC only, so any local time is your own step. The timestamp 1,700,000,000 is 22:13:20 UTC on November 14, 2023, and subtracting five hours gives 17:13:20 in New York, which was on standard time at UTC minus 5 on that date. Always label a time with its zone or an offset, and prefer UTC when you store or exchange timestamps. Daylight saving time causes a day of 23 hours when clocks go forward and a day of 25 hours when they go back, which affects clock differences that span the change. In the United States, daylight saving time begins on the second Sunday in March and ends on the first Sunday in November. A clock-only calculation ignores these changes, so for events across a changeover, use timestamps with explicit offsets in the Time Duration Calculator and compare the elapsed seconds.

Notable timestamps and the year 2038 limit

Some values are worth recognizing. The signed 32-bit integer holds a maximum of 2,147,483,647, which corresponds to 2038-01-19 03:14:07 UTC. Systems that store Unix time in a signed 32-bit field overflow one second later, a limit often called the year 2038 problem. Modern systems use 64-bit time values, which push the limit billions of years away, but embedded devices, old file formats and databases with 32-bit columns may still carry the old limit. If you convert a timestamp near 2,147,483,647, the converter helps you confirm the date a system will hit it. Unsigned 32-bit fields reach 4,294,967,295, which is in 2106. This is a practical reason to check the width of the timestamp column in any long-lived system, particularly for dates such as loan maturities and certificate expiry that reach decades into the future.

Worked examples

Suppose a log shows a start timestamp of 1,700,000,000 and an end timestamp of 1,700,005,400. The difference is 5,400 seconds, which is 90 minutes, or 1 hour 30 minutes. Converting both with the Unix Timestamp Converter gives 2023-11-14T22:13:20Z and 2023-11-14T23:43:20Z, and entering those two strings into the Time Duration Calculator returns 5,400 seconds. If the log was taken in New York in November 2023, the same two moments written as 17:13:20-05:00 and 18:43:20-05:00 also return 5,400. Next, an overnight security round starting at 23:20 and ending at 05:05 has a clock difference of 345 minutes with Next day selected, which is 5 hours 45 minutes, or 5.75 decimal hours. These examples use illustrative data. In each case the method is the same: convert to a common unit, subtract, and convert back, keeping the zone and the date in view when the interval is longer than a day.

Common mistakes and how to avoid them

Most errors come from a handful of habits. People treat 1.5 hours as 1 hour 50 minutes because they read the decimal as minutes. They subtract clock times without noticing that the end falls on the next day. They paste a millisecond timestamp into a seconds field. They display a UTC time as if it were local, then conclude the system clock is wrong. They forget that a day can have 23 or 25 hours near a daylight saving change. And they store local times without an offset, which makes the data ambiguous when clocks go back and the same hour occurs twice. Write the unit next to each number, store UTC with an offset where you can, and convert to local time only for display. A quick check against a known value, such as the epoch at zero, tells you whether a tool is using seconds or milliseconds.

Readable formats and storing times

People exchange timestamps as text in ISO 8601, and the profile in RFC 3339 is common on the web. The timestamp 1,700,000,000 appears as 2023-11-14T22:13:20Z, where the T separates date from time and the Z means UTC. A local time carries an offset instead, such as 2023-11-14T17:13:20-05:00, and both strings describe the same moment. The Time Duration Calculator accepts exactly this style of input, with up to three fractional-second digits. Sorting such strings alphabetically works when they use the same offset, which is one reason to normalize to UTC. For storage, keep the instant (a Unix timestamp or a UTC string) and, if needed, the zone name as a separate field, because an offset such as -05:00 does not tell you whether daylight saving time applies on other dates. Avoid storing a local wall-clock time alone for events that must happen at an exact moment. The Unix Timestamp Converter shows you the UTC string for a number when you debug logs, compare database rows or read an API response.

Leap seconds and the length of a day

Civil time is based on UTC, which is kept within a second of the Earth's rotation by occasionally inserting a leap second. Twenty-seven have been added since 1972, the most recent at the end of 2016. Unix time does not show them. Systems either repeat a second or smear the extra second across a long window, so a timestamp near a leap second can be ambiguous by one second. In 2022 the General Conference on Weights and Measures resolved to stop applying leap seconds by or before 2035, which would remove this special case. All three tools on this hub exclude leap seconds, so a day is 86,400 seconds and the difference between two timestamps is accurate to the second in that model. Precise astronomy, satellite timing and some financial systems use other time scales. For scheduling, billing or report generation, the Unix count is more than enough.

Frequently asked questions

Which tool do I use to convert a Unix timestamp?
Use the Unix Timestamp Converter. It expects whole seconds, so check that your number has 10 digits (seconds) and not 13 (milliseconds) before you enter it.
How do I handle a shift that crosses midnight?
Set the end time to Next day in the Clock Time Difference Calculator, so 22:00 to 06:30 returns 510 minutes, which is 8 hours 30 minutes. Choosing Same day with an earlier end time returns an error. Use full timestamps if the interval can exceed 24 hours.
Does Unix time include leap seconds?
No. Unix time treats every day as 86,400 seconds, so the leap seconds added to UTC are not counted in the number.
Is 1.75 hours the same as 1 hour 75 minutes?
No. 1.75 hours is 1 hour 45 minutes, because 0.75 of an hour is 45 minutes. Multiply the decimal part by 60 to get minutes.

Explore related formulas, units and constants →