Browser time vs Server Time.

Discussion in 'Java' started by BigKat, Jul 14, 2006.

  1. BigKat

    BigKat Guest

    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.
     
    BigKat, Jul 14, 2006
    #1
    1. Advertising

  2. 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


    BigKat wrote:
    > 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, Jul 14, 2006
    #2
    1. Advertising

  3. BigKat

    Nigel Wade Guest

    BigKat wrote:

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


    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.

    --
    Nigel Wade, System Administrator, Space Plasma Physics Group,
    University of Leicester, Leicester, LE1 7RH, UK
    E-mail :
    Phone : +44 (0)116 2523548, Fax : +44 (0)116 2523555
     
    Nigel Wade, Jul 17, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. -
    Replies:
    2
    Views:
    403
    Alan Krueger
    Jul 29, 2005
  2. flamesrock
    Replies:
    8
    Views:
    470
    Hendrik van Rooyen
    Nov 24, 2006
  3. msdngroup
    Replies:
    5
    Views:
    714
    msgroup
    Jan 30, 2008
  4. msdngroup
    Replies:
    0
    Views:
    585
    msdngroup
    Dec 15, 2007
  5. msdngroup
    Replies:
    5
    Views:
    367
    msgroup
    Jan 30, 2008
Loading...

Share This Page