Time Zone Converter Calculator Formula
Understand the math behind the time zone converter calculator. Each variable explained with a worked example.
Formulas Used
Target Time (24hr)
target_hour = raw_target >= 0 ? (raw_target < 24 ? raw_target : raw_target - 24) : raw_target + 24Time Difference
hour_difference = abs(offset_diff)Variables
| Variable | Description | Default |
|---|---|---|
source_hour | Source Time (24hr) | 14 |
source_offset | Source UTC Offset(hrs) | -5 |
target_offset | Target UTC Offset(hrs) | 1 |
offset_diff | Derived value= target_offset - source_offset | calculated |
raw_target | Derived value= source_hour + offset_diff | calculated |
How It Works
How Time Zone Conversion Works
Each time zone is defined as an offset from UTC (Coordinated Universal Time). To convert, calculate the difference in offsets and add it to the source time.
Formula
Target Time = Source Time + (Target UTC Offset - Source UTC Offset)
If the result is negative, add 24 (previous day). If over 23, subtract 24 (next day).
Worked Example
It is 14:00 (2 PM) in UTC-5 (New York). What time is it in UTC+1 (Paris)?
source_hour = 14source_offset = -5target_offset = 1
- 01Offset difference = 1 - (-5) = 6 hours
- 02Target time = 14 + 6 = 20:00 (8 PM)
- 03Paris is 6 hours ahead of New York
Ready to run the numbers?
Open Time Zone Converter Calculator