The only way you should do it is as follows:
string zoneId = "Central European Standard Time";
TimeZoneInfo tzi = TimeZoneInfo.FindSystemTimeZoneById(zoneId);
DateTime result = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow,tzi);
Console.WriteLine("Time is " + result + " in Denmark");
Using the TimeZoneInfo class is the only reliable way in .Net to convert to/from different timezones AND get proper DST conversions.
TimeZoneInfo.ConvertTimeToUtc(dtLocal,tzi)
is the reverse converting from a local time to a utc time.
For the TimeZone Id strings, you can run the bit of code here...
foreach( var tz in TimeZoneInfo.GetSystemTimeZones() )
{
Console.WriteLine(tz.DisplayName + " is Id=','" + tz.Id + "'");
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…