This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes Handling different TimeZone in EJB Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Reply Bookmark "Handling different TimeZone in EJB " Watch "Handling different TimeZone in EJB " New topic
Author

Handling different TimeZone in EJB

deroshal
Greenhorn

Joined: Aug 17, 2001
Posts: 8
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.
<code>
_stmt.setTimestamp(1, new Timestamp(new java.util.Date().getTime()),Calendar.getInstance(TimeZone.getTimeZone("GMT")));
</code>
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?
Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Handling different TimeZone in EJB
 
Similar Threads
Problem in retrieving data with java.util.Date()
Hadling TimeZone in applets
Handling different TimeZone
Convert Date from one timezone to another
Daylight Saving Time in Java5