Connect via MCP →

Enter Calculation

Formula

Advertisement

Results

Hours Until Target Time
8
hours from now
Hours (whole) 8
Minutes (remainder) 0

What this calculator does

The Hours Until a Given Time Calculator tells you how much time remains between the current clock time and a target time later in the day. It works on a rolling 24-hour cycle, so if the target time has already passed today, the result counts forward to that same time tomorrow. This makes it handy for countdowns, shift timing, alarms, and scheduling.

Clock face with an arc sweeping from a current time to a later target time
The calculator measures the gap from the current time to the target time on a 24-hour cycle.

How to use it

Enter the current time using the current hour (0–23) and current minute fields, then enter the target time the same way. The calculator converts both times to seconds since midnight, finds the forward-going difference, and reports the gap as a decimal number of hours plus a clean hours-and-minutes breakdown.

The formula explained

Each time is expressed in seconds since midnight. Let N be the current time and T the target time. The seconds remaining are ((T − N) mod 86400 + 86400) mod 86400, where 86400 is the number of seconds in a day. Adding 86400 before the final modulo guarantees a non-negative answer even when the target is earlier in the day. Dividing by 3600 converts seconds to hours.

$$\text{Hours} = \frac{\left[\left(\left(\text{Target H} \times 60 + \text{Target M}\right) - \left(\text{Now H} \times 60 + \text{Now M}\right)\right) \bmod 1440\right]}{60}$$
24-hour timeline ring showing wrap-around past midnight from now to target
When the target time is earlier in the day, the count wraps past midnight across the 24-hour cycle.

Worked example

Suppose it is 9:00 (now) and the target is 17:00. In seconds, \(N = 32400\) and \(T = 61200\). The difference is 28800 seconds. Dividing by 3600 gives 8 hours exactly—that is, 8 hours and 0 minutes until 5 PM.

$$\frac{61200 - 32400}{3600} = \frac{28800}{3600} = 8$$

FAQ

What if the target time is earlier than now? The calculator assumes you mean the next occurrence, so it counts forward into the following day. For example, from 22:00 to 06:00 returns 8 hours.

Does it use a 12-hour or 24-hour clock? Inputs use the 24-hour clock (0–23 for hours). Convert PM times by adding 12, so 5 PM is hour 17.

Is the result rounded? The main value is shown to two decimal places, and the table breaks the same gap into whole hours and remaining minutes.

Last updated: