This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes JDBC and the fly likes MySQL to Java Date Inaccuracy Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Databases » JDBC
Bookmark "MySQL to Java Date Inaccuracy" Watch "MySQL to Java Date Inaccuracy" New topic

MySQL to Java Date Inaccuracy

Thomas Hubschman
Ranch Hand

Joined: Sep 25, 2002
Posts: 88
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.
[ November 28, 2003: Message edited by: Thomas Hubschman ]

SCJP '02, SCWCD '02, SCJD '08, SCSNB '09, SCEA '10
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
Not sure exactly what the conversion is going wrong. Remember that monthhs in Gregorian Calendar a zero based. i.e. January = 0.

So much trouble in the world -- Bob Marley
Thomas Hubschman
Ranch Hand

Joined: Sep 25, 2002
Posts: 88
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.
GeeCON Prague 2014
subject: MySQL to Java Date Inaccuracy