Automatically determine browser time zone?

Posted on 2006-04-12
Medium Priority
Last Modified: 2006-11-18
I'm developing an application that will be used worldwide.  I think I need to handle and store all dates on the server in GMT time, so I can use TimeZone.setDefault() to set all times to "GMT".  Is that the best approach?  If so, then so far, so good.  

Now, how do I display dates and times on a JSP page in the user's time zone?  I have read up on <fmt:formatDate> and the various time zone tags, but they all assume that I give them the time zone to use.  I don't know what time zone the user is in.  Isn't that something that can be determined by the browser?

Also, when the user inputs a date without a time into a JSP form, how do I convert that back to GMT if I don't know the user's time zone?
Question by:GaryW021199
1 Comment

Accepted Solution

a122178 earned 1000 total points
ID: 16449251
I believe the question is server time vs client time. Since that JSP is the server-side web server, you cannot  determine the Client time from JSP. Remember that the JSP compiled in the server not the client browser. What I suggest to do is to use javascript to pass the client time to the server from HTML form submit.


Hope it helps.



Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This shares a stored procedure to retrieve permissions for a given user on the current database or across all databases on a server.
LinkedIn blogging is great for networking, building up an audience, and expanding your influence as well. However, if you want to achieve these results, you need to work really hard to make your post worth liking and sharing. Here are 4 tips that ca…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question