1

I am new to C# so please excuse me if the question is too simple, I tried the code below and it didn't work

I tried:

//-- Local Time I want to convert
DateTime eventDate1 = new DateTime(2020, 03, 21, 13, 20, 01, DateTimeKind.Local);

//-- Timezone I want to convert to
TimeZoneInfo CentralEurope = TimeZoneInfo.FindSystemTimeZoneById("Central European Time");

//-- Converting local time to Central European Time and returning it as a string 
DateTime targetTime = TimeZoneInfo.ConvertTime(eventDate1, CentralEurope);

return targetTime.ToString("yyyy-MM-ddT00:00:00");
Stefan Wuebbe
  • 2,109
  • 5
  • 17
  • 28
danato61
  • 11
  • 2
  • No question is too simple for Stack Overflow. The only problems would be a poorly asked question or a duplicate. – Traveller Aug 23 '22 at 13:39
  • The timezone string you have throws an exception for me however `"Central European Standard Time"` works for me, is that the issue you are having or is there another problem? – jhambright Aug 23 '22 at 13:51

0 Answers0