GibboK
GibboK

Reputation: 73938

What is the best way to mange Time Zones when Server and Client are in different zones?

I have a MVC app and a Shared MS SQL DataBase in a physical location at GMT -7.

User for the app are based at GMT +2 and all records should be recorded with time GMT +2.

When in .Net or directly from the DB I use DateTime.Now the DB store information at its Local Time.

I need instead having the DB recording the information at GMT +2.

Keeping in consideration that I cannot change Server Time directly (Hosting is shared), what are the possible solutions?

Upvotes: 0

Views: 72

Answers (1)

SimonW
SimonW

Reputation: 6433

Keep all dates and time as UTC and convert to the local time when needed. If your client uses JS you can use moment.js to do the conversion with ease.

I am not familiar with MS SQL but I'm sure you have timezone conversion functions there too.

Upvotes: 3

Related Questions