• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

TimeZone conversion in client/server architecture

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 56
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I found solution of this problem here.

http://techidiocy.com/java-server-and-client-time-zone-difference-problem-solved/
 
Ashsih khurana
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can try this one also.
 
Don't sweat petty things, or pet sweaty things. But cuddle this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic