Returns the current time in milliseconds since January 1, 1970 00:00:00.0 UTC.
This method always returns UTC times, regardless of the system's time zone. This is often called "Unix time" or "epoch time". Use a DateFormat instance to format this time for display to a human.
This method shouldn't be used for measuring timeouts or other elapsed time measurements, as changing the system time can affect the results. Use nanoTime() for that.
1. In the MainActivity.java file, Declare a Long variable named myCurrentTimeMillis.
2. In MainActivity.java file, add the line below to the onCreate method. This will save the current time in milliseconds to long variable named myCurrentTimeMillis.
myCurrentTimeMillis = System.currentTimeMillis();
3. Compile and run!
Next Recommended Article:
Next Recommended Article:
Resources:
http://developer.android.com/reference/java/lang/System.html#currentTimeMillis()
http://developer.android.com/reference/java/lang/System.html#currentTimeMillis()