How to set univeral timezone for entire application in winforms

c#, timezone, winforms

Solution

Unfortunately you cannot (You could look at Jon Skeet response in following thread: Setting/Changing an .NET application's TimeZone). So you have two options:

- Everywhwer use `DateTime.ToUniversalTime` (MSDN description)

- Create your own class which represents `DateTime` and use it instead

- You can use one more trick. You can mock DateTime with for example Microsoft Fakes. Look more here: Using shims to isolate your application from other assemblies for unit testing

Problem

How can I set Universal timezone for entire application. So that even if the timezone is changed, the application should show time as per universal timezone. So is it possible to set entire application timezone?

Original source

Related problems