aspose file tools
The moose likes Applets and the fly likes Hadling TimeZone in applets Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Applets
Reply Bookmark "Hadling TimeZone in applets" Watch "Hadling TimeZone in applets" New topic
Author

Hadling TimeZone in applets

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.
_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?
Thanks

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 14487
    
    7

You're shifting your frame of reference in mid-process. You understand that if the server's in GMT+5 and the client's in GMT-10 that the record would be stamped GMT (as long as the server allowed for it), but you're expecting the record retrieved to be GMT-10! If it went IN GMT, it will come BACK GMT except as it may be converted.
The only place where confusion could apply is if you wanted to enter or retrieve times in the local reference frame, in which case you simply bias the GMT based on the client's locale info - add bias going down, subtact bias coming back.


Customer surveys are for companies who didn't pay proper attention to begin with.
deroshal
Greenhorn

Joined: Aug 17, 2001
Posts: 8
Tim,
Thanks for your reply.
I would like to know what is the industry I18N standard to handle different time zones and I would appreciate, if you could give provide a few examples.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Hadling TimeZone in applets
 
Similar Threads
Date according to timezone
Problem in retrieving data with java.util.Date()
Handling different TimeZone in EJB
Handling different TimeZone
Daylight Saving Time in Java5