I want to record the time using System.currentTimeMillis() when a user begins something in my program. When he finishes, I will subtract the current Syste
System.currentTimeMillis()
Syste
Using the java.time package in Java 8:
Instant start = Instant.now(); Thread.sleep(63553); Instant end = Instant.now(); System.out.println(Duration.between(start, end));
Output is in ISO 8601 Duration format: PT1M3.553S (1 minute and 3.553 seconds).
PT1M3.553S