Link to home
Start Free TrialLog in
Avatar of Marc Rosema
Marc Rosema

asked on

asp.net time zone settings

I want to let the end user choose their time zone and store this in to a database or web.config and use this setting throughout the application for setting the creation time to their time in stead of the servers time the application is running on.

How  can do this the best way?
ASKER CERTIFIED SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If your application will be used by multiple people across multiple time zones, and those people can view data from all users, this is not a wise idea, as it will skew the times seen by these other people. It is better to store your dates using the server time and use ASP.Net to localize the dates for the person viewing the information.

This link from Microsoft's website provides information on how to do this: https://msdn.microsoft.com/en-us/library/w7x1y988(v=vs.110).aspx
You can ask the client for their timezone and store that.  I would store all events with a timestamp set to GMT/UCT, then adjust the timestamp by the client's offset when you're showing it to the client.