Use TimeZoneInfo.ConvertTime to convert the source time zone (CET) to the target time zone (UK).
public static DateTime ConvertTime( DateTime dateTime, TimeZoneInfo sourceTimeZone, TimeZoneInfo destinationTimeZone )
The complete MSDN guide is here :
Convert time between time zones
Changed example code from MSDN:
DateTime ceTime = new DateTime(2007, 02, 01, 08, 00, 00); try { TimeZoneInfo ceZone = TimeZoneInfo.FindSystemTimeZoneById("Central Europe Standard Time"); TimeZoneInfo gmtZone = TimeZoneInfo.FindSystemTimeZoneById("GMT Standard Time"); Console.WriteLine("{0} {1} is {2} GMT time.", ceTime, ceZone.IsDaylightSavingTime(ceTime) ? ceZone.DaylightName : ceZone.StandardName, TimeZoneInfo.ConvertTime(ceTime, ceZone, gmtZone)); } catch (TimeZoneNotFoundException) { Console.WriteLine("The registry does not define the required timezones."); } catch (InvalidTimeZoneException) { Console.WriteLine("Registry data on the required timezones has been corrupted."); }
Steve Townsend Oct 27 '10 at 15:35 2010-10-27 15:35
source share