String strtest="2007-08-17 21:50:58.0 "; //界面上传的也可以
public Date stringToDate(String str){
Date rcreate=new Date();
java.text.SimpleDateFormat newstr=new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
rcreate=newstr.parse(str);
} catch (ParseException e) {
e.printStackTrace();
}
return rcreate;
}
- 提问者评价
-
00
参考资料:http://hi.baidu.com/lz726/blog/item/e707ee33812b1e41ac4b5f05.html