We are developing an ASP.net application which stores the date and time in UTC format. This application will be used globally. But each location will run separate instance of application and will have its own database.
Is it possible to auto convert the date and time when user is viewing the date time value without having to get the local time zone (Like EST,CST,PST ...) in C#.?
I can use as
DateTime convertTime = TimeZoneInfo.ConvertTimeFromUtc(
In an ASP.Net application,
TimeZoneInfo.Local refers to the time zone of the server - not the user. In general, it's a bad practice to rely on the server's time zone to be set to anything in particular.
The behavior you're asking about is already covered by the
DateTime.Now property, which uses the local time zone, much in the way you showed in your code.
No, there's no way to use web.config settings or any other settings to globally change the local time zone. That's a per-machine setting, and is system-wide across all applications.