【发布时间】:2013-04-02 13:36:42
【问题描述】:
我在尝试让日期在我的应用程序中正确显示时遇到了麻烦,这里是代码
//i declare the calendar called now
private Calendar now;
//i set up the calendar with what i believe could be the problem in setting up the wrong date
now = Calendar.getInstance();
now.set(Calendar.MONTH, Calendar.MONTH);
now.set(Calendar.DAY_OF_MONTH, Calendar.DAY_OF_MONTH);
now.set(Calendar.DAY_OF_WEEK, Calendar.DAY_OF_WEEK);
//whatDay being a textview, is asked to display the date
whatDay.setText(DateFormat.format("E, dd MMMM", now));
目前,就显示日期而言,一切正常 - 只是显示了错误的日期,这有点问题
【问题讨论】:
-
您可以使用
Calendar添加天数或任何您想要的,但这个问题非常模糊。你有什么相关的代码要展示吗?
标签: java android parsing date calendar