• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Handling different TimeZone in EJB

Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Our EJB application which is browser based JApplet has to accomodate Internationalization(I18N). When ever we write the Date ,we write with time and with the insatnce of "GMT".
The sample code looks as below to write date.
_stmt.setTimestamp(1, new Timestamp(new java.util.Date().getTime()),Calendar.getInstance(TimeZone.getTimeZone("GMT")));
Though the user is sitting in a different TimeZone and inserting a record, the insert date will be always the server TimeZone which is different from the user's TimeZone.
Assuming that the serve is in USA and user is in Asia, the user is trying to insert a recod at 13th at 7PM. But that record will be written as 14th at 3AM in the server side due to diffeent TimeZone.
Now, the user tries to retrieve the same record immediately, he may not able to retrieve it because it is wriiten as a different day.
I would like to know how to solvw this different TimeZone issues?
    Bookmark Topic Watch Topic
  • New Topic