• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem with Date and Time

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am developing a GWT application. I have some input of date and time and save it into the database. When i save the date and time in db, it saves one hour before, even i am saving in the same format to whom i took the input. Kindly help me how can i resolve this problem. I want to save the same date and time to the database so that i can access it into the different reports. Waiting for your quick response.
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Looks like a time zone issue and/or a difference between the client server times. How are you passing the date/time to the server?
 
ahmad razaa
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is the code of the client from where i took the input.


And here is the code on the server where i changed the zone and then save it to database.



If i run this code on local computer then its work fine. but if i run this on my server, then its save one hour before in database. I think its a problem of daylight saving. I tried alot of different ways. But they are not working.
 
ahmad razaa
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But i get the date time in my application it shows the right time. But in database it saves 1 hour before. Actually i am also generating jasper reports from the database, in that reports it always shows 1 hour before. One solution can that i plus one hour in reports but i dont know how can i do that, i didnot find the solution yet..
 
ahmad razaa
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I solved the problem somehow, although its not a good solution but its works for saving the date and time


It save the exact date and time of client. But when i read it from the database and show it in my application it shows 1 hour after this. I think the problem is, the server uses the london time zone when i display it in my application, application opens in copenhagen and it automatically add 1 hour. Please let me know how can i resolve the problem. When i use the same method with the date and time from db it adds two hours. Please let me know any appropriate solution.
 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check both server and local machine time zones. I also had this issue. when I changed time zones of the client machines the problem disappears.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic