System.currenttimemillis (): The number of milliseconds that can be extracted to the current time, producing a current millisecond, which is actually the number of milliseconds since 0 o'clock January 1, 1970.
Common role: Generally use 2 time difference to get run time, commonly used to compare the efficiency of 2 algorithms.
Long start = System.currenttimemillis ();
Here you can add the time you want to know how the method runs.
Long end = System.currenttimemillis ();
System.out.println ("Running Time:" + (End-start));
format system.currenttimemillis ()
1 Import Java.text.SimpleDateFormat;
2 Import Java.util.Locale;
3
4
5 public class Formatcurrenttime {
6/**
7 * @param args
8 */
9 public static void Main (string[] args) {
10
One simpledateformat SDF = new SimpleDateFormat ("", Locale.simplified_chinese);
Sdf.applypattern ("yyyy mm month DD Day hh when mm minute ss seconds");
System.out.println (Sdf.format (System.currenttimemillis ()));
14
15}
16}
17