Timezone Offset Converter Formula

Understand the math behind the timezone offset converter. Each variable explained with a worked example.

Formulas Used

Target Time (24hr)

target_hour = ((source_hour + diff) + 48) - floor(((source_hour + diff) + 48) / 24) * 24

Time Difference

offset_diff = diff

UTC Equivalent

utc_time = ((source_hour - source_offset) + 48) - floor(((source_hour - source_offset) + 48) / 24) * 24

Variables

VariableDescriptionDefault
source_hourSource Time (24hr)(hour)14
source_offsetSource UTC Offset(hours)-5
target_offsetTarget UTC Offset(hours)1
diffDerived value= target_offset - source_offsetcalculated

How It Works

Timezone Conversion

Target Time = Source Time + (Target Offset - Source Offset)

If the result exceeds 24, subtract 24 (next day). If negative, add 24 (previous day).

Common UTC Offsets

| Zone | Offset | |---|---| | PST | UTC-8 | | MST | UTC-7 | | CST | UTC-6 | | EST | UTC-5 | | GMT/UTC | UTC+0 | | CET | UTC+1 | | IST | UTC+5:30 | | JST | UTC+9 |

Worked Example

Convert 2:00 PM EST (UTC-5) to CET (UTC+1).

source_hour = 14source_offset = -5target_offset = 1
  1. 01Difference = +1 - (-5) = +6 hours
  2. 02Target time = 14 + 6 = 20:00 (8:00 PM CET)
  3. 03UTC equivalent = 14 + 5 = 19:00 UTC

Ready to run the numbers?

Open Timezone Offset Converter