Automatically determine browser time zone?

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?
GaryW021199Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

http://javascript.about.com/library/bltime2.htm
http://www.tizag.com/javascriptT/javascriptdate.php

Hope it helps.

Cheers!

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JSP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.