Hours Until a Given Time Calculator

Hours Until a Given Time Calculator

Leading AI Skill PRO

Enter Calculation

Results

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

Formula

Hours=[((Target H×60+Target M)−(Now H×60+Now M))mod1440]60\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}
Usage stats

Advertisement

Report an error on this page

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}$$
Advertisement
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$$

Example Countdowns for Different Time Pairs

The calculator converts both times to minutes since midnight, subtracts the current time from the target, and wraps the result into a 0–1439 minute range (modulo 1440). The target is always the next time that clock reading occurs, so a countdown never exceeds 23 h 59 m.

Current Time Target Time Hours (decimal) Hours and Minutes Crosses Midnight?
09:00 17:00 8 8h 0m No
22:00 06:00 8 8h 0m Yes
23:30 00:15 0.75 0h 45m Yes
14:45 14:15 23.5 23h 30m Yes
12:00 12:00 0 0h 0m (same time returns 0, not 24) No
00:00 23:59 23.9833 23h 59m No

Worked check for 14:45 → 14:15: target = 14 × 60 + 15 = 855 minutes; now = 14 × 60 + 45 = 885 minutes. The difference is 855 − 885 = −30, and (−30) mod 1440 = 1410 minutes, which is 1410 ÷ 60 = 23.5 hours, or 23h 30m.

Worked check for 23:30 → 00:15: target = 15 minutes; now = 1410 minutes. The difference is 15 − 1410 = −1395, and (−1395) mod 1440 = 45 minutes = 0.75 hours.

Advertisement

12-Hour to 24-Hour Clock Conversion

The calculator expects hours on a 24-hour clock (0–23). Use this table to convert 12-hour times before entering them.

12-Hour Clock Hour AM → 24-Hour PM → 24-Hour
12 12 AM = 0 12 PM = 12
1 1 AM = 1 1 PM = 13
2 2 AM = 2 2 PM = 14
3 3 AM = 3 3 PM = 15
4 4 AM = 4 4 PM = 16
5 5 AM = 5 5 PM = 17
6 6 AM = 6 6 PM = 18
7 7 AM = 7 7 PM = 19
8 8 AM = 8 8 PM = 20
9 9 AM = 9 9 PM = 21
10 10 AM = 10 10 PM = 22
11 11 AM = 11 11 PM = 23

Rule: AM hours stay the same, except 12 AM becomes 0. For PM hours, add 12, except 12 PM, which stays 12. Minutes never change. Example: 7:30 PM is 19:30, so enter 19 for the hour and 30 for the minutes.

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:

Most popular in Time and Date

View all Time and Date calculators