Timestamp转化为String:
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//定义格式,不显示毫秒
Timestamp now = new Timestamp(System.currentTimeMillis());//获取系统当前时间
String str = df.format(now);
String转化为Timestamp:
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String time = df.format(new Date());
String time = df.format(new Date());
Timestamp ts = Timestamp.valueOf(time);
该博客为转载内容,转载自https://www.cnblogs.com/ericsun/archive/2012/06/21/2558086.html ,涉及Java相关知识。

410

被折叠的 条评论
为什么被折叠?



