This discussion is archived
3 Replies Latest reply: Jun 29, 2013 4:04 PM by jschellSomeoneStoleMyAlias RSS

Issue in using timezone setting

Zaif Newbie
Currently Being Moderated

We have a java app. The data is stored in an Oracle db .The time is stored in GMt.

 

We set the timezone to GMT using

TimeZone.setDefault(tzGMT)

 

 

So when the time is displayed .It gets displayed in local time. There is no problem with this.

 

But other applications sharing the same JVM has a problem.

 

I would like to know how to correct this problem  ?

Thanks in advance

 

Regards,

Zaif

  • 1. Re: Issue in using timezone setting
    BIJ001 Explorer
    Currently Being Moderated

    Maybe the other applications already picked up the stuff before this one's setting the default timezone.

     

    What about using this command line System property setting?

    -Duser.timezone=GMT

  • 2. Re: Issue in using timezone setting
    rp0428 Guru
    Currently Being Moderated

    We have a java app. The data is stored in an Oracle db .The time is stored in GMt.

     

    We set the timezone to GMT using

    TimeZone.setDefault(tzGMT)

     

     

    So when the time is displayed .It gets displayed in local time. There is no problem with this.

     

    But other applications sharing the same JVM has a problem.

     

    I would like to know how to correct this problem  ?

     

    Correct what problem? You haven't said WHAT problem you are talking about; all you said was 'has a problem'.

     

    Post ALL of the information about what the problem is and an example of the 'problem'.

  • 3. Re: Issue in using timezone setting
    jschellSomeoneStoleMyAlias Expert
    Currently Being Moderated

    > The time is stored in GMt.

     

    I question how that is stated.

     

    Oracle, not your app, has a timezone.  Presumably you mean that Oracle is set to use GMT (or more likely UMT).

     

    And then you use the appropriate JDBC/db framework code to store timestamps.  And specifically there are no 'tricks' using strings to store timestamp\date values.

     

    > TimeZone.setDefault(tzGMT)

     

    That has nothing to do with storage in Oracle.  Java keeps timestamps in UMT always.  That code has nothing to do with that.  So at best it could have an impact on how your parse incoming data in your application or how you display it.  But then it would have nothing to do with Oracle and, presumably, it would be obvious that the wrong value is stored in Oracle itself.

     

    > But other applications sharing the same JVM has a problem.

     

    What do you mean by "application"?  If you are using a JEE server like tomcat\jboss then I wouldn't suppose that setting the timezone in one application would impact another.

     

    However if you mean that you are running an 'application' using a different process then that application would need to do something with the timezone itself.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points