查找夏令时城市 [英] Find Daylight saving cities

查看:148
本文介绍了查找夏令时城市的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我希望搜索那些接受夏令时标准的城市.我正在使用Windows2008-R2平台和MFC语言.
请帮助.但是,请注意,时区(通常)并不适用于城市,而是适用于国家或部分国家/地区.


检索时区信息

商品号:Q115231
本文中的信息适用于:
Microsoft Win32应用程序编程接口(API):

在Windows NT及更高版本中,时区字符串位于键中:


HKEY_LOCAL_MACHINE \ SOFTWARE \
微软\
Windows NT \
CurrentVersion \
时区.


在Windows 95中,时区字符串位于以下项中:

HKEY_LOCAL_MACHINE \ SOFTWARE \
微软\
Windows \
CurrentVersion \
时区.


对于每个时区,注册表项TZI的格式如下:

长偏差;
LONG StandardBias;
LONG DaylightBias;
SYSTEMTIME StandardDate;
SYSTEMTIME DaylightDate;


您可以使用此信息填写TIME_ZONE_INFORMATION
结构,在调用SetTimeZoneInformation()时使用.

0xffffffc4
00000000
0xffffffc4
年月日星期几小时分钟秒毫秒
0000 000A 0000 0005 0003 0000 0000 0000

0000 0003 0000 0005 0002 0000 0000 0000


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



TIME_ZONE_INFORMATION
TIME_ZONE_INFORMATION结构指定信息
特定于时区.

typedef struct _TIME_ZONE_INFORMATION {//tzi
长偏差;
WCHAR StandardName [32];
SYSTEMTIME StandardDate;
长StandardBias;
WCHAR DaylightName [32];
SYSTEMTIME DaylightDate;
长日照偏差
} TIME_ZONE_INFORMATION;

成员

偏差
指定本地时间的当前偏差(以分钟为单位)
在这台计算机上翻译.偏见就是区别,在
分钟,介于协调世界时(UTC)和本地时间
时间. UTC与当地时间之间的所有翻译均基于
以下公式:

UTC =当地时间+偏差

该成员是必需的.

StandardName
指定与标准
关联的以空字符结尾的字符串 在此操作系统上的时间.例如,此参数
可以包含"EST"以表示东部标准时间.这个
操作系统不使用字符串,因此存储的所有内容
使用SetTimeZoneInformation函数返回的结果
GetTimeZoneInformation函数保持不变.此字符串
可以为空.

StandardDate
指定包含日期和本地
的SYSTEMTIME结构 从夏令时转换为标准时间的时间
在此操作系统上发生.如果未指定此日期,
SYSTEMTIME结构中的wMonth成员必须为零.如果
指定此日期后,
中的DaylightDate值 还必须指定TIME_ZONE_INFORMATION结构.
该成员支持两种日期格式.绝对格式
指定标准时间开始的确切日期和时间.在
这种形式,wYear,wMonth,wDay,wHour,wMinute,wSecond,
和SYSTEMTIME结构的wMilliseconds成员已使用
指定确切的日期.

通过设置wYear成员来指定日格式
为零,将wDayOfWeek成员设置为适当的
工作日,并在1到5到
的范围内使用wDay值 选择月份中的正确日期.使用此表示法,
可以指定4月的第一个星期日,也可以指定最后一个
10月的星期四(5等于最后一个").

StandardBias
指定在本地时间使用的偏差值
在标准时间内进行的翻译.该成员是
如果未提供StandardDate成员的值,则忽略.
此值添加到Bias成员的值以形成
标准时间使用的偏差.在大多数时区,
该成员的值为零.

DaylightName
指定与日光关联的以空字符结尾的字符串
在此操作系统上的时间.例如,此参数
可以包含"PDT"以指示太平洋夏令时间.这个
操作系统未使用字符串,因此存储的所有内容
使用SetTimeZoneInformation函数返回的结果
GetTimeZoneInformation函数保持不变.此字符串
可以为空.

DaylightDate
指定包含日期和
的SYSTEMTIME结构 从标准时间转换为日光的当地时间
时间在此操作系统上发生.如果该日期不是
指定,SYSTEMTIME结构中的wMonth成员必须
为零.如果指定了此日期,则
中的StandardDate值 还必须指定TIME_ZONE_INFORMATION结构.
该成员支持绝对时间和每月时间格式
针对StandardDate成员进行了说明.

DaylightBias
指定在本地时间转换期间使用的偏差值
发生在白天.如果
该成员将被忽略 没有提供DaylightDate成员的值.
此值加到Bias成员的值上,以形成
白天使用的偏差.在大多数时区,
的值 这个成员是–60.


另请参见
时间概述,
时间结构,
GetTimeZoneInformation,
SetTimeZoneInformation,
SYSTEMTIME


不确定是否有相应的库.

您可能必须编写自己的DLL.


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.

解决方案

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


Not sure there is a library for that.

You may have to write your own DLL.


这篇关于查找夏令时城市的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆