可能重复:
MySql 日期时间不返回时间
如果我从 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
为什么?