View Single Post

  #2 (permalink)  
Old 03-30-2006
Brian Wakem
 
Posts: n/a
Default Re: Java: MySQL DATETIME conversion errors?

Cédric Pillonel wrote:

> I do the following in my java application:
>
> Statement s = myConnection.createStatement();
> ResultSet rs = s.executeQuery("SELECT startTime FROM MyTable WHERE
> _rowid=1");
> if (rs.next())
> {
> java.sql.Timestamp stamp = (java.sql.Timestamp)rs.getObject(1);
> String startTime = stamp.toString();
> }
>
> I get the following value in startTime: "2006-03-02 12:00:00.0"
> But in the database is the following value stored: "2006-02-30 12:00:00.0"



No such date as Feb 30th


> I am running MySQL 4.1.12 on RedHat Linux ES 4.0 EMT64.
> I run my java application on Windows 2000 with java 1.5.0_03-b07 and
> mysql-connector-java-3.1.12. I have also tried
> mysql-connector-java-5.0.0-beta, same problem.
>
> Any idea?



It is assuming you mean 2 days after Feb 28th.


--
Brian Wakem
Email: http://homepage.ntlworld.com/b.wakem/myemail.png
Reply With Quote