String字符串转换成timestamp的简单⽅式
在数据库中数据类型为Datetime,反向⽣成到java后台数据类型为timestamp,java获取的当前时间为Date,我们需要将Date类型转换为String 类型并选择⾃⼰想要的展⽰形式,,转为String类型后我们将String类型转换成timestamp即可。
string转date的方法·  Date opeartime= new Date();//获取服务器当前时间
SimpleDateFormat time = new SimpleDateFormat ("yyyy-MM-dd hh:mm:ss");//将当前时间转化成String格式
Timestamp timea=Timestamp.valueOf(time.format(opeartime)) ;//将String强制转换成timestamp格式