代码:
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); Date date=new Date(); String time=sdf.format(date); Timestamp timestamp=Timestamp.valueOf(time);
将一定格式的时间 ,保存到数据库中。
代码:
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); Date date=new Date(); String time=sdf.format(date); Timestamp timestamp=Timestamp.valueOf(time);