即時通訊從weeknumber創建日期,以及僅限於星期幾。我已經成功完成了SimpleDateFormat,但我想將它保存爲jodatime,我已經嘗試了很多事情,但沒有任何實際工作。將SimpleDateFormat解析爲JodaTime
這是我的代碼到目前爲止。
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
Calendar cal = Calendar.getInstance();
cal.set(Calendar.WEEK_OF_YEAR, week_of_year);
cal.set(Calendar.DAY_OF_WEEK, day_of_week);
sdf.format(cal.getTime());
DateTimeFormatter dtf = DateTimeFormat.forPattern("MM/dd/yyyy HH:mm:ss");
DateTime jodatime = dtf.parseDateTime(sdf.toString());
我想得到一個jodatimeså,我的日曆可以根據日期,時間安排對象進行排序。
當我運行的代碼,並要顯示的jodatime,我得到這個錯誤:
java.lang.IllegalArgumentException: Invalid format: "[email protected]"
at org.joda.time.format.DateTimeFormatter.parseDateTime(DateTimeFormatter.java:945)
at com.example.casper.autimeplan.Fragments.ScheduleFragment$MyJavaScriptInterface.getBasicInfo(ScheduleFragment.java:282)
at com.example.casper.autimeplan.Fragments.ScheduleFragment$MyJavaScriptInterface.access$400(ScheduleFragment.java:186)
at com.example.casper.autimeplan.Fragments.ScheduleFragment$MyJavaScriptInterface$1.run(ScheduleFragment.java:203)