• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 591
  • Last Modified:

Hibernate returning incorrect date value from Sql Server

Hello - I have a Sql Server database that has a column with a field type of "datetime", which is filled with values automatically by hibernate's timestamp.  One record is stored with the value "4/19/2006 9:45:00 AM", but when I retrieve the object from hibernate and use a get method, it returns a different datetime (when I format the output, it looks like this: "04/18/2006 06:00:00 AM").  I want to use the Calendar object to check if a date I have is after the value in the database, but I am getting incorrect output because the date is being returned to me wrong.

I'd appreciate your help!
0
sb1977
Asked:
sb1977
  • 2
1 Solution
 
Mayank SAssociate Director - Product EngineeringCommented:
Maybe its a problem with the Locale. Where is the DB server running and where is the application running? Are they on 2 different time zones?
0
 
sb1977Author Commented:
That's a good point, I'll look into it some more.  However, even if it were in a different time zone, the minutes would be the same.  The strange thing about this issue is that hibernate is setting and getting the field from my Java application, but the values are different.
0
 
Mayank SAssociate Director - Product EngineeringCommented:
However the time difference looks to be more than 24 hours so its doubtful if time zones are causing the problem.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now