jsp读出数据库精度太高

来源:百度知道 编辑:UC知道 时间:2024/05/24 10:00:37
在数据库是2007-03-09
读到jsp上却是
2007-03-09 00:00:00.000
postdate=rs1.getString("postdate");
out.print(postdate);
怎么解决啊?

postdate=rs1.getString("postdate").split(" ")[0];
out.print(postdate);

既然用的是getString读出来的,就根据需要处理一下呗……
out.print(postdate.subString(0, 10));

你数据库的字段类型为字符型?应该不会出这种问题,除非你的字段类型为日期时间类型