0
如果我這樣做,從consele的mysql:
SELECT CREATION from MYDATABASE WHERE NAME='MyData';
我得到2012-07-12 13:42:55
但如果這樣做從Java:
String sql = "SELECT CREATION from MYDATABASE WHERE NAME=?";
PreparedStatement ps = null;
String creationQuery;
ResultSet rs = null;
try
{
ps = conn.prepareStatement(sql);
ps.setString(1, "MyData");
rs = ps.executeQuery();
creationQuery = rs.next() ? rs.getString(1) : null;
}
我得到2012-07-12 13:42:55.0
爲什麼?
http://stackoverflow.com/questions/2305973/java-util-date-vs-java-sql-date請參閱java和sql的日期對象之間的差異 – gtiwari333 2012-07-17 10:26:17
非常感謝您和抱歉重複 – Jjreina 2012-07-17 10:58:05