1. Get by date in Util package
Date date = new Date ();
SimpleDateFormat dateformat= New SimpleDateFormat ("Yyyy-mm-dd:hh:mm:ss");
System.out.println (Dateformat.format (date));
2. Access through calendar of util packages
Calendar calendar= calendar.getinstance ();
SimpleDateFormat dateformat= New SimpleDateFormat ("Yyyy-mm-dd:hh:mm:ss");
System.out.println (Dateformat.format (Calendar.gettime ()));
3. Through the calendar of Util package acquisition time, respectively, to obtain the date
Calendar cal=calendar.getinstance ();
int Y=cal.get (calendar.year);
int M=cal.get (calendar.month);
int D=cal.get (calendar.date);
int H=cal.get (calendar.hour_of_day);
int Mi=cal.get (calendar.minute);
int S=cal.get (calendar.second);
System.out.println ("The present moment is" +y+ "the Year" +m+ "the Month" +d+ "the Day" +h+ "" The +mi+ "" The Minute "+s+" the second ");