Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / July 2006

Tip: Looking for answers? Try searching our database.

Browser time vs Server Time.

Thread view: 
BigKat - 14 Jul 2006 20:51 GMT
I have a jsp / portlet / webservices application that has realtime
graphing capabilities.   The problem I am having is when the machine
that is serving up the jsp / portlet is in a different timezone than
the machine that the browser is running on.

For example, application / server machine is running in New York,
therefore that is where the locale from the request is from.   The
browser is being run on a box in California..   The data showing up in
the graph is in the New York timezone.   So it appears to be 3 hours
off for the user that has his web browser on his pc in his office.

So now to my question.  Has anyone retrieved the browsers machine
timezone.   My thought is that the code would have to be in a jsp (some
script language??).

any help would be appreciated.
Mohan Kakulavarapu - 14 Jul 2006 22:08 GMT
I assume the graph generation code is in your JSP. When the JSP is
being executed
you have to pass the browsers's local time zone in the request or it
must be
previously set either in session or application objects.
If end user is accessing the JSP page by typing in the URL directly, I
don't have a
solution. If the JSP page is accessed through some HTML hyperlink or
through FORM
action, then in this HTML page you can have a hidden field which can be
set
to local timezone using javascript Date Object. This hidden field will
be available
in request object to your JSP. Hope this helps

Mohan Kakulavarapu
Freelance Java Developer

> I have a jsp / portlet / webservices application that has realtime
> graphing capabilities.   The problem I am having is when the machine
[quoted text clipped - 12 lines]
>
> any help would be appreciated.
Nigel Wade - 17 Jul 2006 09:54 GMT
> I have a jsp / portlet / webservices application that has realtime
> graphing capabilities.   The problem I am having is when the machine
[quoted text clipped - 12 lines]
>
> any help would be appreciated.

Don't use relative times, use absolute times. I.e. do away with the ambiguity of
local timezones, DST etc. and use UTC in all communication between the client
and server. Let the client display the time in whatever way is appropriate,
UTC, local, with or without DST etc.

Signature

Nigel Wade, System Administrator, Space Plasma Physics Group,
           University of Leicester, Leicester, LE1 7RH, UK
E-mail :    nmw@ion.le.ac.uk
Phone :     +44 (0)116 2523548, Fax : +44 (0)116 2523555



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.