将数据库获取到的date转换成按格式输出的String
String createdate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(rs.getTimestamp("createdate"))
将String转换成date
Timestamp birthday = new Timestamp(new SimpleDateFormat("yyyy-MM-dd").parse(rs.getString("birthday")).getTime());
引用到的类
import java.sql.Timestamp;
import java.text.SimpleDateFormat;