我尝试将格式日期解析Fri Mar 30 00:00:00 CET 14为dd / mm / yyyy
Fri Mar 30 00:00:00 CET 14
这是我的代码
SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); System.out.println(formatter.parse(date_retour.toString()));
错误 java.text.ParseException: Unparseable date: "Fri Mar 30 00:00:00 CET 14"
java.text.ParseException: Unparseable date: "Fri Mar 30 00:00:00 CET 14"
请帮助
现在还可以
try { SimpleDateFormat formatter = new SimpleDateFormat("EEE MMM dd HH:mm:ss Z", Locale.ENGLISH); SimpleDateFormat formatter2 = new SimpleDateFormat("dd-MM-yyyy"); Date date; date = formatter.parse(date_retour.toString()); donnees [i][9] =formatter2.format(date); } catch (ParseException ex) { Logger.getLogger(operation2.class.getName()).log(Level.SEVERE, null, ex); }
您需要将日期格式模式与输入匹配 String
String
SimpleDateFormat formatter = new SimpleDateFormat("EEE MMM dd HH:mm:ss Z", Locale.ENGLISH);