伙计我需要帮助我想显示月份和日期以及随后7天的日期,如
周六 - 22 太阳 - 23 星期一 - 24 ..
使用循环
我应该在循环中的方法::
Calendar cal = new GregorianCalendar();
for(i = 0;i<7;i++)
{
int month = cal.get(Calendar.MONTH);
int dayOfMonth = cal.get(Calendar.DAY_OF_MONTH + i); // Giving error here
day[i] = dayOfMonth + month + "";
}
我完全是这个领域的初学者,我很困惑帮助我
答案 0 :(得分:0)
更改:
int dayOfMonth = cal.get(Calendar.DAY_OF_MONTH) + i;
为:
Calendar cal = Calendar.getInstance();
for(i = 0; i < 7; i++) {
cal.add(Calendar.DAY_OF_MONTH, 1); // Adds a day to the date and takes care
// of adding month when its the last day of the month already
int weekDay = cal.get(Calendar.DAY_OF_WEEK); // Get weekday name like Sunday
int dayOfMonth = cal.get(Calendar.DAY_OF_MONTH)
day[i] = weekDay + " - " + dayOfMonth;
}
将修正错误。
但是你想要做的事情可以通过以下方式更好地完成:
20:22:37,295 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/md-edrs]] (ServerService Thread Pool -- 74) JBWEB000287: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener: org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'configurationHelper' defined in ServletContext resource [/WEB-INF/config/web-application-config.xml]: Could not resolve placeholder 'build.number'