How to get a time zone?


I need to have my current time zone as a number for a face that shows my earth position.

Right now I’m using (#DH#-#DUH#) , but that creates 2 problems:

  1. It freaks out when it’s near midnight (changes from 2 to -22)
  2. I have no control over daylight saving time beeing included or not.

Any ideas?

Hey Mellin,
The daylight savings thing is a boondoggle. For U.S. it’s just a fixed date right in most software code. I had a 2005 Acura TL that was manufactured before George W changed the day light savings dates (Energy Policy Act of 2005). So every year after that my car would change clocks on the wrong dates twice per year that I had to manually adjust four times (twice in the spring and twice in the fall). You could conditionally shift the hour by hard coding the day counts:

  • Daylight savings always starts on the 10th sunday after any New Year
  • Daylight saving always ends on the 45th sunday after any New Year
    You won’t be able to work with dates or days because New years could fall on Sunday and you have leap years. You’d have to get the weekday number of new years, then mathematically skip forward to the first Sunday, then hop forward another 9 and 44 weeks forward to land on the 10th weekend and the 45th weekend.

Again this is only for U.S.