0
我試圖日期格式從轉換「陶氏週一DD HH:MM:SS ZZZ YYYY」到「MM/DD/YYYY」異常中的日期格式轉換
String inputPattern = "dow mon dd hh:mm:ss zzz yyyy";
String outputPattern = "MM/dd/yyyy";
SimpleDateFormat inputFormat = new SimpleDateFormat(inputPattern);
SimpleDateFormat outputFormat = new SimpleDateFormat(outputPattern);
Date date=inputFormat.parse("Tue Dec 07 15:59:03 IST 2010");
System.out.println("Date : "+outputFormat.format(date));
但是雖然上述運行代碼發生以下異常
Exception in thread "main" java.lang.IllegalArgumentException: Illegal pattern character 'o'
at java.text.SimpleDateFormat.compile(SimpleDateFormat.java:769)
at java.text.SimpleDateFormat.initialize(SimpleDateFormat.java:576)
at java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:501)
at java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:476)
at com.kpub.web.bean.action.ReportGeneration.main(ReportGeneration.java:198)
可能是什麼問題?
+1這是工作fine.Thanks。 – i2ijeya 2010-12-08 12:08:11