Java TimeUnit.toMillis(long duration)
Syntax
TimeUnit.toMillis(long duration) has the following syntax.
public long toMillis(long duration)
Example
In the following code shows how to use TimeUnit.toMillis(long duration) method.
import java.util.concurrent.TimeUnit;
//w w w . j a va 2s . com
public class Main {
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.toMillis(1));
}
}