This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MySQL to Java Date Inaccuracy

 
Thomas Hubschman
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello fellow ranchers,
I am reading a DATE column from a MySQL table and am having a conversion problem. The date is stored is stored as:

But when read into a GregorianCalendar via

It looses a month to

Can any one help me out with this one???
Thanks much.
Tom
[ November 28, 2003: Message edited by: Thomas Hubschman ]
 
Bosun Bello
Ranch Hand
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure exactly what the conversion is going wrong. Remember that monthhs in Gregorian Calendar a zero based. i.e. January = 0.
 
Thomas Hubschman
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks that was it.
I'm not sure what genius thought that up. It should be at least corrected in the JDBC driver so datatypes don't require an bizzare ++MONTH exression.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic