The question is about formatting Date/ Timestamprather than internal precision (the date contains milliseconds). Try formatting Timestampso as not to show fractional seconds, use SimpleDateFormat, for example: Date of time stamp;
ResultSet rs=smt.executeQuery("select * from posttopic where name='"+logn+"'");
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
while(rs.next())
{
name=rs.getString(1);
title=rs.getString(2);
subject=rs.getString(3);
message=rs.getString(4);
date=rs.getTimestamp(5);
System.out.print(sdf.format(date));
}
source
share