logo image

Java program to show current time in milliseconds



Below program shows you how to print current time in milliseconds. We can get current milliseconds using System.currentTimeMillis() in java.

import java.time.LocalTime;
import java.util.Scanner;

public class Basic12 {

	public static void main(String[] args) {

		long currentTimeInMilliSeconds = System.currentTimeMillis();

		System.out.println("Current time in milliseconds: " + currentTimeInMilliSeconds);

	}
}

Output:

Current time in milliseconds: 1521735714734