【发布时间】:2013-03-05 13:51:01
【问题描述】:
在 2013 年,英国将在 3 月 31 日之前开始夏令时。
不过,当我尝试将给定时间转换为 UTC 时间时,TimeZoneInfo.ConvertTimeToUtc 会减去一小时。
这是为什么?我是否需要告诉这个方法夏令时没有激活?
var now = new DateTime(DateTime.Now.Ticks, DateTimeKind.Unspecified);
var convertedTime = TimeZoneInfo.ConvertTimeToUtc(now, TimeZoneInfo.FindSystemTimeZoneById("W. Europe Standard time"));
Console.WriteLine(convertedTime); // subtracts one hour, even though England time and GMT should be equal
【问题讨论】:
-
W. Europe Standard时区不是UTC+01.00? -
你真的应该试试 @JonSkeet 的 NodaTime noda-time.blogspot.com。它应该作为新的 DateTime API 包含在 .NET 中。
-
@Soner Gonul:不,不是。不是夏令时。
-
目前那个时区 是 UTC+1。
-
@Matthew Watson:根据这个网站是 +0000 UTC:worldtimeserver.com/mobile/mobile_time_in_GB.aspx