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!
sb1977Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.