Java日历 Calendar clear方法


Java日历 Calendar clear方法

package com.codingdict;

import java.util.*;

public class CalendarDemo {
   public static void main(String[] args) {

      // create calendar object
      Calendar cal = Calendar.getInstance();

      // displays the current date and time
      System.out.println("Current Calendar Date: " + cal.getTime());

      // use clear method to set all field values and time value as undefined.
      cal.clear();

      // print the result
      System.out.println("The calendar shows : " + cal.getTime());
   }
}