java 下个月的第一天和最后一天
3个回答
展开全部
Calendar c = Calendar.getInstance();
System.out.println(c.getTime());
c.set(Calendar.MONTH, c.get(Calendar.MONTH)+1);
c.set(Calendar.DAY_OF_MONTH, 1);
System.out.println("下个月的第一天: " + c.getTime());
c.set(Calendar.MONTH, c.get(Calendar.MONTH)+1);
c.set(Calendar.DAY_OF_MONTH, 0);
System.out.println("下个月的最后一天: " + c.getTime());
System.out.println(c.getTime());
c.set(Calendar.MONTH, c.get(Calendar.MONTH)+1);
c.set(Calendar.DAY_OF_MONTH, 1);
System.out.println("下个月的第一天: " + c.getTime());
c.set(Calendar.MONTH, c.get(Calendar.MONTH)+1);
c.set(Calendar.DAY_OF_MONTH, 0);
System.out.println("下个月的最后一天: " + c.getTime());
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询