我想获取当前系统时间,然后通过 formatter 解析它SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
。
我.... error : java.text.ParseException: Unparseable date: "Tue Jan 13 17:05:51 PST 2015"
在以下方法中使用:
public static void currentSystemTime() {
Calendar calendar = new GregorianCalendar();
try {
System.out.println(format.parse(calendar.getTime().toString()));
} catch (ParseException ex) {
Logger.getLogger(DateDifference.class.getName()).log(Level.SEVERE, null, ex);
}
}
如何以匹配的文字格式获取系统时间SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
?