Java 日期时间格式化穿越小时和月1


Java 日期时间格式化穿越小时和月1

import java.util.Calendar;

public class CalendarExample {
   public static void main(String[] args) {
      Calendar cal = Calendar.getInstance();
        System.out.println("Time:" + cal.getTime());

      cal.roll(Calendar.YEAR, false);
        System.out.println("Time rolling down the year:" + cal.getTime());

      cal.roll(Calendar.HOUR, true);
        System.out.println("Time rolling up the hour:" + cal.getTime());
   }
}