Search code examples
timezoneutctimezone-offsetlocaltime

Timezone Calculations


I have customer1 for whom timezone is -9:00 UTC I have customer2 for whom timezone in +5:00 UTC

so when customer1 sends Date and time, I need to convert to align it to time of customer2, here is what I am doing-

cust1UTCOffset = -540 cust2UTCOffset = 300

calculateOffset = cust2UTCOffset - cust1UTCOffset = 840 min

which is equal to 14 Hrs.

now if customer1 sends 23-Sep-1016 2:00 AM for customer2 after above calculation it will become - 16:00 PM

I tried to validate in windows7 change date and timezone setting. for similar configuration and times it returns 15:00 PM.

can anybody please suggest what I am missing here?


Solution

  • One of the time zones you selected could be on daylight savings time, which could offset your expected result by one hour.