Get elapsed time in minutes : Timing « Development Class « Java






Get elapsed time in minutes

  


public class Main {
  public static void main(String[] argv) throws Exception {
    long start = System.currentTimeMillis();

    Thread.sleep(2000);

    // Get elapsed time in milliseconds
    long elapsedTimeMillis = System.currentTimeMillis() - start;
    
    // Get elapsed time in minutes
    float elapsedTimeMin = elapsedTimeMillis/(60*1000F);
    System.out.println(elapsedTimeMin);
  }
}

   
    
  








Related examples in the same category

1.Compute and display elapsed time of an operation
2.Get system time using System class
3.Class for program event timing
4.Get elapsed time in milliseconds
5.Get elapsed time in seconds
6.Get elapsed time in hours
7.Get elapsed time in days
8.Get time in milliseconds using Java Calendar
9.java.util.concurrent.TimeUnit: convert between milliseconds and days
10.Get seconds since