JSP - determine user's local time zone

M

Martin

Hi,

Is there any way to determine (or even guess?) the time zone from which a
user is making a request to a JSP server? java.util.TimeZone.getDefault()
gets the time zone of the server running the application, so that route
doesn't seem to help and getting the user's Locale isn't accurate enough, as
I can't, for example, determine from which time zone requests in the US are
being made... any ideas...?



Thanks,

Martin.
 
A

Andrew Thompson

Is there any way to determine (or even guess?) the time zone from which a
user is making a request to a JSP server?

Ask the user.. [ Be warned it requires the
'wetware api' plug-in installed and correctly
configured on the 'user agent', so it's
effectiveness is patchy at best. ;-) ]
 
P

P.Hill

Martin said:
Hi,

Is there any way to determine (or even guess?) the time zone from which a
user is making a request to a JSP server? java.util.TimeZone.getDefault()
gets the time zone of the server running the application, so that route
doesn't seem to help and getting the user's Locale isn't accurate enough, as
I can't, for example, determine from which time zone requests in the US are
being made... any ideas...?

If you ran similar code in an applet you would get the answer on the VM running
in the browser, hence in the local machine of the user. Then provide that
information somehow to Javascript to a form to ...
I'll leave the entire problem as an exercise for the reader. :)

-Paul
 
J

Johnny Storm

P.Hill said:
If you ran similar code in an applet you would get the answer on the VM running
in the browser, hence in the local machine of the user. Then provide that
information somehow to Javascript to a form to ...
I'll leave the entire problem as an exercise for the reader. :)

-Paul

You may not even need the applet if you're going to use JavaScript anyway.
Just use JavaScript to grab the local time of the user's computer, and then
send the info back to the server.
(Of course, you've lost the whole sandbox principal, but hey, you were
almost certainly going to lose it anyway.)


Johnny

p.s. Any part of post that felt like crap, retort with better crap, please
;) . . . .
 
P

P.Hill

Johnny said:
You may not even need the applet if you're going to use JavaScript anyway.
Just use JavaScript to grab the local time of the user's computer, and then
send the info back to the server.

It is not always the case that knowing the time of a location can help you
determine the timezone. For example, Arizona (USA), sometimes
keeps the same time as California which it borders and sometimes the
same time as the other states around it. This is because it does NOT go
on Daylight Savings Time, AKA summertime. When you live somewere it
gets 112 degrees F, you want the sun to go down, believe me.
Going from time to timezone is not a 1 to 1 mapping. Consider also different
jurisdictions in which the DLS switch over date is not the same
in all cases. While contigous areas like to keep their switch over
dates the same for practical reasons, you can't tell where someone
is coming from just from their wall time.

-Paul
 
L

Liz

P.Hill said:
It is not always the case that knowing the time of a location can help you
determine the timezone. For example, Arizona (USA), sometimes
keeps the same time as California which it borders and sometimes the
same time as the other states around it. This is because it does NOT go
on Daylight Savings Time, AKA summertime. When you live somewere it
gets 112 degrees F, you want the sun to go down, believe me.
Going from time to timezone is not a 1 to 1 mapping. Consider also different
jurisdictions in which the DLS switch over date is not the same
in all cases. While contigous areas like to keep their switch over
dates the same for practical reasons, you can't tell where someone
is coming from just from their wall time.

-Paul
Not only that, different Countries change to/from daylight savings
on days that are not the same as the USA change days.
Countries in North America (USA, Canada, Mexico) end Standard

(or Winter) Time on Sunday 4th April 2004.

The clocks go forward in the whole of the European Union and

associate countries (including Lithuania which will now observe

Summer time) a week earlier on Sunday 28th March 2004.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top