sql中如何将string型时间存入到数据库中date型时间中呢?

方法
String Nowtime=new SimpleDateFormat(“yyyy-MM-dd”).format(new Date());//一个string类型的当前时间
java.sql.Date mysqldate=java.sql.Date.valueOf(Nowtime);//将string型写入数据库date型

以下以hibernate内为例子
在这里插入图片描述
保存当前时间string型到数据库中date型

猜你喜欢

转载自blog.csdn.net/qzw5235641/article/details/84136977