即时通讯从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)