我发现'中大西洋标准时间'的窗口时区与IANA的映射是“Etc / GMT + 2”和“Etc / GMT + 1”
从真实数据中,我发现: 2011年3月27日上午3:00:00至2011年9月25日上午12:59:59将是Etc / GMT + 1 2011年9月25日上午1:00:00至2012年3月25日凌晨2:59:59将是Etc / GMT + 2
这是我用来证明映射是正确的代码:
var currentDateTime = DateTime.Now;
int currYear = currentDateTime.Year;
using(var database = Common.Patterns.TimeZoneInfo.Database.IANA.OpenInMemroyReadOnlyDatabase())
{
var winTimeZone = System.TimeZoneInfo.FindSystemTimeZoneById("Mid-Atlantic Standard Time");
var commonTimeZoneSG = Zone.FindZone(database, "Atlantic/South_Georgia", ZoneNameTypes.IANATZName);
var commonTimeZoneNoronho = Zone.FindZone(database, "America/Noronha", ZoneNameTypes.IANATZName);
var commonTimeZoneGMT2 = Zone.FindZone(database, "Etc/GMT+2", ZoneNameTypes.IANATZName);
var commonTimeZoneGMT1 = Zone.FindZone(database, "Etc/GMT+1", ZoneNameTypes.IANATZName);
for (int nMonth = 1; nMonth <= 12; ++nMonth)
{
int nbrDays = DateTime.DaysInMonth(currYear, nMonth);
for (int nDay = 1; nDay <= nbrDays; ++nDay)
{
var currDateTime = new DateTime(currYear, nMonth, nDay, 11, 30, 09);
//September 30 - March 24
if(winTimeZone.GetUtcOffset(currDateTime) == commonTimeZoneSG.DetermineUTCOffset(currDateTime).Value)
{
break;
}
else if(winTimeZone.GetUtcOffset(currDateTime) == commonTimeZoneNoronho.DetermineUTCOffset(currDateTime).Value)
{
break;
}
else if(winTimeZone.GetUtcOffset(currDateTime) == commonTimeZoneGMT2.DetermineUTCOffset(currDateTime).Value)
{
break;
}
//March 25 - September 29
if(winTimeZone.GetUtcOffset(currDateTime) == commonTimeZoneGMT1.DetermineUTCOffset(currDateTime).Value)
{
break;
}
else
{
Console.WriteLine(string.Format("not mappable for {0}",currDateTime));
break;
}
}
}
}
这是我发现的过渡规则:
System.TimeZoneInfo.FindSystemTimeZoneById("Mid-Atlantic Standard Time").GetAdjustmentRules().Dump();
我似乎无法将我发现的转换开始和结束规则与实际数据联系起来。 它说它从凌晨2点开始,但我的真实数据是凌晨3点,结束于凌晨1点。
任何人都可以解释一下吗?