Date class: Constructs an instance that reacts to the current time.
Date S=new date (); System.out.println (s);
The print variable s can get the current time of the computer, which can be specific to the time unit ' seconds '.
Long Starttime=system.currenttimemillis ();
Long Endtime=system.currenttimemillis ();
StartTime and Endtime count the execution time, which is the time that the code between the two expressions executes. This allows you to calculate the efficiency of the current code execution.
DateFormat: Formats the current time and date.
As in the following section of code:
Date S=new date ();D Ateformat fu=dateformat.getdateinstance (dateformat.full); System.out.println (Fu.format (s));
After using DateFormat, the resulting date format is as follows:
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M00/8A/1B/wKioL1gnEP-QHq5gAAAGB38Web0337.png-wh_500x0-wm_3 -wmp_4-s_2011948645.png "title=" capture. PNG "alt=" Wkiol1gnep-qhq5gaaagb38web0337.png-wh_50 "/>
SimpleDateFormat: is also formatted with the current time and date, and DateFormat is expressed differently.
As follows:
Date S=new date (); SimpleDateFormat ff=new SimpleDateFormat ("yyyy years mm DD Day E hh mm min ss sec sss milliseconds"); System.out.println (Ff.format (s));
The effect of running:
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M02/8A/1F/wKiom1gnEdODPdeYAAAMswyzOYc865.png-wh_500x0-wm_3 -wmp_4-s_4206555979.png "title=" Capture 2. PNG "alt=" Wkiom1gnedodpdeyaaamswyzoyc865.png-wh_50 "/>
Date class, time and date format class