我想得到我的java程序的ans,我想找出当天是一年中的哪一天,本周是一年中的哪一周等。当我尝试使用日历类方法执行此操作时,它给出了错误的答案.
下面是我的代码
{
Calendar c1 = Calendar.getInstance();
c1.setTime(new Date());
System.out.println("Today is "+Calendar.DAY_OF_YEAR+" day of year");
System.out.println("Today is "+Calendar.WEEK_OF_YEAR+" week of year");
System.out.println("Today is "+Calendar.DAY_OF_WEEK_IN_MONTH+" day of week in month");
}
输出:-
Today is 6 day of year
Today is 3 week of year
Today is 8 day of week in month
任何人都可以帮助找出解决方案吗?