Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

ResultSet getDate conversion to Util Date?  RSS feed

 
Peter White
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it a general practice to do something like the following:

java.util.Date myDate = new java.util.Date(rs.getDate(col).getTime());

Or is there a better technique? I read somewhere that doing the above might change the date because of a nanosecond bug in Java?

Thanks

Peter
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 37180
515
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Peter,
That's what I've always used. I haven't had any conversion problems, but that doesn't mean there isn't a problem.
 
Peter White
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the issue I saw was maybe more to do with sybase only storing fractions of seconds. Basically I was getting a slightly different date back from what I was storing.

Thanks

Peter
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!