Monday 7 May 2007

Timezone Information on Windows

I was trying to find out how to grab the current timezone settings from the Windows registry, so I searched on the Internet, and eventually found where it was stored

(HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation)

, but most sites that showed the data structure were wrong. Only with one thing, that was which 16 bit integer represented the day of the week. Most sites said it was the 3rd Integer, but actually, it is the 8th (or last) Integer in the keys "StandardStart" and "DaylightStart". Eventually I found a site that said the right thing, so I'm going to list it here anyway.

 

Path: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation
Keys: StandardStart and DaylightStart
All integers are two byte big endian
Integer IndexRepresents
0Year: 0 = 1900
1Month: 1 = January ... 12 = December
2Week: 1 = First week ... 5 = Last Week
3Hour: 0 = Midnight, 23 = 11pm
4Minute: 0 - 59
5Second: 0 - 59
6Millisecond: 0 - 999
7Day of week: 0 = Sunday ... 6 = Saturday

 

So, there you have it.

No comments: