Search code examples
c#timezonerdp

TimeZoneInfo in different language on RDP


In the source code of our app we have got following line:

pcTimezone = System.TimeZoneInfo.Local.Id;

When I work locally on my office PC (Windows 10 in English, regional settings: English (USA)) everything is fine and pcTimezone is set to "Central European Standard Time", but when I am connected from home by RDP System.TimeZoneInfo.Local.Id returns

"Środkowoeuropejski Czas stand"

which is in Polish.

This leads to error

Time zone ID "Środkowoeuropejski Czas stand" was not found on the local computer

on line TimeZoneInfo.FindSystemTimeZoneById(pcTimezone)

I tried setting everything what I could to English on my home computer (system language is unchangeable so it is Polish still) and it did not help.

Is there any way to force value of System.TimeZoneInfo.Local? Or maybe you are able to set RDP not to override it from outer computer?


Solution

  • It turned out that for a some strange reason, when connected via RDP, a Time zone of the office PC got set to the earliest possible: (UTC-12:00) International Date Line West.

    All I had to do was setting this value to the correct one, and the problem was gone.