asp.net time zone settings

Marc Rosema
Marc Rosema used Ask the Experts™
on
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?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Software Team Lead
Commented:
My suggestion is to save the setting into database for 2 purposes (at least):

1. secure the confidential data
2. easier for maintenance and customization
Shaun KlineLead Software Engineer

Commented:
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
Paul MacDonaldDirector, Information Systems

Commented:
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.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial