Java Data Type Tutorial - Java System.currentTimeMillis()








Syntax

System.currentTimeMillis() has the following syntax.

public static long currentTimeMillis()

Example

In the following code shows how to use System.currentTimeMillis() method.


public class Main {

   public static void main(String[] args) {

      System.out.print("Current Time in milliseconds = ");
      System.out.println(System.currentTimeMillis());
  }
}

The code above generates the following result.