Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: MFC Win2008-R2
Hi,
I wan search the list of those cities which have accepted daylight saving standard. I am working on platform Windows2008-R2 and language MFC.
Please Help.
Posted 22-Jun-10 0:46am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

The following information seems to have disappeared from MSDN but should give you a head start. However, note that time zones do not (in general) apply to cities, but to countries or parts of countries.
 

Retrieving Time-Zone Information
 
Article ID: Q115231
The information in this article applies to:
Microsoft Win32 Application Programming Interface (API):
 
In Windows NT and beyond, the time-zone strings are located in the key:
 

HKEY_LOCAL_MACHINE\SOFTWARE\
Microsoft\
Windows NT\
CurrentVersion\
Time Zones.
 

In Windows 95, the time-zone strings are located in the key:
 
HKEY_LOCAL_MACHINE\SOFTWARE\
Microsoft\
Windows\
CurrentVersion\
Time Zones.
 

For each time zone, the registry key TZI is formatted as follows:
 
LONG Bias;
LONG StandardBias;
LONG DaylightBias;
SYSTEMTIME StandardDate;
SYSTEMTIME DaylightDate;
 

You can use this information to fill out a TIME_ZONE_INFORMATION
structure, which is used when calling SetTimeZoneInformation().

0xffffffc4
00000000
0xffffffc4
Year Month dow day hour min sec msec
0000 000A 0000 0005 0003 0000 0000 0000
 
0000 0003 0000 0005 0002 0000 0000 0000
 

--------------------------------------------------------------------------------
 

 
TIME_ZONE_INFORMATION
The TIME_ZONE_INFORMATION structure specifies information
specific to the time zone.
 
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;

Members
 
Bias
Specifies the current bias, in minutes, for local time
translation on this computer. The bias is the difference, in
minutes, between Coordinated Universal Time (UTC) and local
time. All translations between UTC and local time are based on
the following formula:
 
UTC = local time + bias

This member is required.
 
StandardName
Specifies a null-terminated string associated with standard
time on this operating system. For example, this parameter
could contain "EST" to indicate Eastern Standard Time. This
string is not used by the operating system, so anything stored
there by using the SetTimeZoneInformation function is returned
unchanged by the GetTimeZoneInformation function. This string
can be empty.
 
StandardDate
Specifies a SYSTEMTIME structure that contains a date and local
time when the transition from daylight time to standard time
occurs on this operating system. If this date is not specified,
the wMonth member in the SYSTEMTIME structure must be zero. If
this date is specified, the DaylightDate value in the
TIME_ZONE_INFORMATION structure must also be specified.
This member supports two date formats. Absolute format
specifies an exact date and time when standard time begins. In
this form, the wYear, wMonth, wDay, wHour, wMinute, wSecond,
and wMilliseconds members of the SYSTEMTIME structure are used
to specify an exact date.
 
Day-in-month format is specified by setting the wYear member
to zero, setting the wDayOfWeek member to an appropriate
weekday, and using a wDay value in the range 1 through 5 to
select the correct day in the month. Using this notation, the
first Sunday in April can be specified, as can the last
Thursday in October (5 is equal to "the last").
 
StandardBias
Specifies a bias value to be used during local time
translations that occur during standard time. This member is
ignored if a value for the StandardDate member is not supplied.
This value is added to the value of the Bias member to form
the bias used during standard time. In most time zones, the
value of this member is zero.
 
DaylightName
Specifies a null-terminated string associated with daylight
time on this operating system. For example, this parameter
could contain "PDT" to indicate Pacific Daylight Time. This
string is not used by the operating system, so anything stored
there by using the SetTimeZoneInformation function is returned
unchanged by the GetTimeZoneInformation function. This string
can be empty.
 
DaylightDate
Specifies a SYSTEMTIME structure that contains a date and
local time when the transition from standard time to daylight
time occurs on this operating system. If this date is not
specified, the wMonth member in the SYSTEMTIME structure must
be zero. If this date is specified, the StandardDate value in
the TIME_ZONE_INFORMATION structure must also be specified.
This member supports the absolute and day-in-month time formats
described for the StandardDate member.
 
DaylightBias
Specifies a bias value to be used during local time translations
that occur during daylight time. This member is ignored if a
value for the DaylightDate member is not supplied.
This value is added to the value of the Bias member to form the
bias used during daylight time. In most time zones, the value of
this member is – 60.
 

See Also
Time Overview,
Time Structures,
GetTimeZoneInformation,
SetTimeZoneInformation,
SYSTEMTIME
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Not sure there is a library for that.
 
You may have to write your own DLL.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 190
1 Jochen Arndt 155
2 PIEBALDconsult 150
3 Afzaal Ahmad Zeeshan 120
4 DamithSL 115
0 OriginalGriff 5,695
1 DamithSL 4,591
2 Maciej Los 4,012
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,190


Advertise | Privacy | Mobile
Web03 | 2.8.141220.1 | Last Updated 22 Jun 2010
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100