TimeZoneInfo.ConvertTimeFromUtc を使用して、UTC 時間を現地時間に変換します。タイムゾーン「Central America Standard Time」に変換すると、結果はサマータイムを考慮していないようです。
このページhttp://www.timeanddate.com/worldclock/city.html?n=24と私の顧客によると、テキサス州オースティンでは夏時間が設定されています
私のテストコード:
DateTime result;
DateTime utcTime = Convert.ToDateTime("20.04.2013 11:32:00");
try
{
TimeZoneInfo sourceTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Central America Standard Time");
result = TimeZoneInfo.ConvertTimeFromUtc(utcTime, sourceTimeZone);
}
catch (Exception)
{
result = Convert.ToDateTime("01.01.1900 00:00:00");
}
Console.WriteLine();
Console.WriteLine( Convert.ToString(result) );
20.04.2013 06:32:00 の代わりに 20.04.2013 05:32:00 を指定します (-5 時間の dst オフセット)。メソッドの使用方法は間違っていますか? フレームワークのバグ?Windows の構成が間違っていますか?
感謝と敬意
マルク