当前位置: 代码迷 >> SQL >> 将string部类的时间转换成SQL date 型
  详细解决方案

将string部类的时间转换成SQL date 型

热度:413   发布时间:2016-05-05 12:47:09.0
将string类型的时间转换成SQL date 型
// 将string类型的时间转换成SQL date 型
public Date dateChange(String date1)
{
SimpleDateFormat  sdf =new  SimpleDateFormat("yyyy-MM-dd"); 
      java.util.Date cDate;
Date dd=null;
   try {
cDate = sdf.parse(date1);
dd =new Date(cDate.getTime());

} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();

return dd;

}
  相关解决方案