本帖最后由 杜光 于 2013-7-27 14:48 编辑
- String dateFormatString = "yyyy/MM/dd HH:mm:ss";
- SimpleDateFormat format = new SimpleDateFormat(dateFormatString);
- format.setLenient(false);
- try {
- Date date = format.parse("2012/11/09 12:34:07");
- //format = new SimpleDateFormat(dateFormatString, Locale.getDefault())
- System.err.println(date.toLocaleString());
- } catch (ParseException ex) {
- Logger.getLogger(Utility.class.getName()).log(Level.SEVERE, null, ex);
- }
复制代码 报一下错误
java.text.ParseException: Unparseable date: "yyyy/MM/dd HH:mm:ss"
at java.text.DateFormat.parse(DateFormat.java:337)
at com.vanch.sdk.Utility.isValiadDateString(Utility.java:102)
at com.vanch.test.NewClass.main(NewClass.java:40)
|
|