我正在尝试用Calendar
java编写一个输出html
带有表格内部的网页Calendar
,但是在尝试获取特定年份中特定月份的天数时遇到了问题。
这是我正在使用的代码:
//accept input from command prompt in form of MONTH, DAY, YEAR
String date = args[0];
SimpleDateFormat df = new SimpleDateFormat("MMMM dd, yyyy");
Date convertedDate = new Date();
try
{
convertedDate = df.parse(date);
}
catch(Exception e)
{
System.out.print(e);
}
Calendar cal = Calendar.getInstance();
cal.setTime(convertedDate);
year = cal.get(Calendar.YEAR);
month = cal.get(Calendar.MONTH);
day = cal.get(Calendar.DAY_OF_MONTH);
//get number of days in month
int numDays, startMonth;
numDays = cal.getActualMaximum(DAY_OF_MONTH);
我从最后一行收到错误消息:
error: cannot find symbol and it points to the DAY_OF_MONTH variable.
我该如何解决这个问题?