java日期处理

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());

日期比较:compareTo(日历实力);

你可能感兴趣的:(java)