Get system time using System class
public class Main { public static void main(String[] args) { long lnSystemTime = System.currentTimeMillis(); System.out.println("Milliseconds since midnight, January 1, 1970 UTC : " + lnSystemTime); } }