Using new methods in TimeUnit : TimeUnit « Development « Java Tutorial






import java.util.concurrent.TimeUnit;

public class TimeUnitDemo {
  public static void main(String[] args) {
    TimeUnit tu = TimeUnit.DAYS;

    System.out.println(tu.toDays(1));
    System.out.println(tu.toHours(1));
    System.out.println(tu.toMinutes(1));

  }
}








6.19.TimeUnit
6.19.1.Using new methods in TimeUnit
6.19.2.java.util.concurrent.TimeUnit can be used to convert between milliseconds and days