Java Program to display computer time in milliseconds



Use currentTimeMillis() method in Java to display the computer time in milliseconds.

Here we are getting the milliseconds in long type −

long res = System.currentTimeMillis();

The following is an example −

Example

 Live Demo

public class Demo {
   public static void main(String[] a) {
      long res = System.currentTimeMillis();
      System.out.println(res);
   }
}

Output

1543142485568
karthikeya Boyini
karthikeya Boyini

I love programming (: That's all I know


Advertisements