I have a process that takes a datetime value with a time zone as a string (data comes from an external system). I need to translate this datetime to what time would be in the timezone of local computers.
Code example:
string cetId = "Central European Standard Time"; if (timeZone == "CET") { TimeZoneInfo cetZone = TimeZoneInfo.FindSystemTimeZoneById(cetId); returnDateTime = TimeZoneInfo.ConvertTime(statusDateTime, cetZone, TimeZoneInfo.Local); } else if (timeZone == "CEST") { TimeZoneInfo cestZone = TimeZoneInfo.FindSystemTimeZoneById(cetId); returnDateTime = TimeZoneInfo.ConvertTime(statusDateTime, cestZone, TimeZoneInfo.Local); }
Do I need to do something specific if CEST (Central European Summer Time) instead of CET (Central European Time) or does the .net TimeZoneInfo object process this script?
Tadhg source share