Amitesh
Amitesh

Reputation: 687

TimeZone details with MVC

Hi I am trying to fig out a way to get the clients timezone details and store it in the database which will be used to calculate UTC dates later on. So what I need is

1) a way to get the clients timezone infor WITHOUT the user selecting from a list (so might need a javascript) 2) What are the timezone details I would need to store which I can then later on use to calculate UTC dates for that user

Please note the project is based on MVC framework

Upvotes: 2

Views: 812

Answers (2)

Darin Dimitrov
Darin Dimitrov

Reputation: 1039498

You may try to detect the timezone using javascript and here's a more robust version. Then include it in a hidden field or query string variable so that the server can fetch it.

Upvotes: 2

Kamyar
Kamyar

Reputation: 18797

You can use getTimezoneOffset() method in javascript.
It returns the time difference between Greenwich Mean Time (GMT) and local time, in minutes.

Upvotes: 0

Related Questions