我正在尝试在两个时区之间转换时间,发现美国东部标准时间与西欧时间之间存在小时差,美国东部标准时间(EST) 2018年6月18日下午1点应该是西欧时间同一天下午6点,但c# ConvertTime的结果是晚上7点,我想我错过了一些夏令时设置?不管怎样,下面是代码:
var str = "2018-07-09T13:00:00";
var dt = Convert.ToDateTime(str);
var SourceZoneValue = "Eastern Standard Time";
var DestinationZoneValue = "W. Europe Standard Time";
TimeZoneInfo sourceTimeZone = TimeZoneInfo.FindSystemTimeZoneById(SourceZoneValue);
TimeZoneInfo destinationTimeZone = TimeZoneInfo.FindSystemTimeZoneById(DestinationZoneValue);
DateTime localTime = TimeZoneInfo.ConvertTime(dt, sourceTimeZone, destinationTimeZone);
Console.WriteLine(localTime);
结果是晚上7点而不是6点,你知道吗?tks
发布于 2018-05-30 09:06:17
您想要从东部标准时间转换为西部欧洲标准时间,例如从纽约到阿姆斯特丹。
纽约时区为-5 GMT,阿姆斯特丹时区为+1 GMT:
纽约夏令时从2018年3月11日开始,将于11月4日结束。2018.
你的日期是6月18日,所以夏令时不会影响时差,我想下午7点是正确的结果。
也许W. Europe Standard Time
不是您要查找的正确时区?例如,对于英国时间:
var britishZone = TimeZoneInfo.FindSystemTimeZoneById("GMT Standard Time");
https://stackoverflow.com/questions/50589985
复制相似问题