How to get current time in milliseconds using Java?
Java's java.lang.System
Class has method currentTimeMillis()
method which gives you the How to get current time in milliseconds.
public class GetCurrentMilliseconds {
public static void main(String[] args) {
long currentTimeInMillies = System.currentTimeMillis();
System.out.println("Current time in millies:" + currentTimeInMillies);
}
}
Interesting Fact:
The milliseconds what you see are the difference measured in milliseconds between the current time and midnight, January 1, 1970 UTC.