Re: TZ
- Posted by stabmaster_ at HOTMAIL.COM May 05, 2002
- 354 views
>Hello All. > >Does anyone know how I can get the timezone from the user's computer? > How about using the Win API function DWORD GetTimeZoneInformation( LPTIME_ZONE_INFORMATION lpTimeZoneInformation); where lpTimeZoneInformation points to a TIME_ZONE_INFORMATION struct: typedef struct _TIME_ZONE_INFORMATION { // tzi LONG Bias; WCHAR StandardName[ 32 ]; SYSTEMTIME StandardDate; LONG StandardBias; WCHAR DaylightName[ 32 ]; SYSTEMTIME DaylightDate; LONG DaylightBias; } TIME_ZONE_INFORMATION; Where Bias is the differance between the local time and the Coordinated Universal Time (UTC). StandardDate Specifies a SYSTEMTIME structure that contains a date and UTC when the transition from daylight time to standard time occurs on this operating system. And vice versa for DaylightDate. I assume that by standard time and daylight time they mean winter time and summer time. SYSTEMTIME looks like this: typedef struct _SYSTEMTIME { // st WORD wYear; WORD wMonth; WORD wDayOfWeek; WORD wDay; WORD wHour; WORD wMinute; WORD wSecond; WORD wMilliseconds; } SYSTEMTIME;