aspose file tools*
The moose likes JDBC and the fly likes TimeZone conversion in client/server architecture Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "TimeZone conversion in client/server architecture" Watch "TimeZone conversion in client/server architecture" New topic
Author

TimeZone conversion in client/server architecture

Aaron Young
Greenhorn

Joined: Apr 29, 2011
Posts: 1
I'm working on a Java application that has all sorts of widgets that allow the user to enter various dates/times. This client sends data through Spring, which passes it on to JBoss, which informs Hibernate, which finally delivers the message to MySQL. The goal: to make my server use GMT and the clients to use whatever they want.

I've developed a small bit of code to calculate timezone conversions for me. And I can use the code at entry, and for retrieval, to do my conversion. But this is messy, and error prone, because if I miss a single display, I'll be showing the user wildly varying times. It also becomes tricky when passing from one GUI element to another. (ie. Is this time already converted?)

Wouldn't it be handy to stick my little conversion code somewhere in between client and server? Then there's no mess, the code is all in one place, and I can always be sure what my timezone is, depending where the code is running. The problem: I have several layers... in which layer does this belong? I've also searched in vain for something I can do in one of these layers to automatically convert for me.

In some cases, I found an option to set the timezone, such as in MySQL. But I worry that if clients across multiple timezones are accessing the server, that the server will be passing on its own timezone to MySQL, instead of the client's, resulting in no timezone conversions for dates. Hence, MySQL might be too "deep" for my purposes. Furthermore, it might be possible to set the JVM timezone, in which cases several layers at once get the new timezone, but the same worry still applies. I am fairly ignorant how these components interact with different timezones...

Can anyone give me some direction? I'm assuming there is some industry standard approach to doing this. Thanks.
Ramon Anger
Ranch Hand

Joined: Apr 19, 2011
Posts: 56

Hi Aaron,

there are some tips at http://stackoverflow.com/questions/1686448/client-side-time-zone-support-in-gwt that may help you.

Best,
Ramon


Blackbelt on BlackBeltFactory.com.
Ashsih khurana
Greenhorn

Joined: Jul 20, 2013
Posts: 4
I found solution of this problem here.

http://techidiocy.com/java-server-and-client-time-zone-difference-problem-solved/
Ashsih khurana
Greenhorn

Joined: Jul 20, 2013
Posts: 4
You can try this one also.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: TimeZone conversion in client/server architecture