Java TimeUnit.toSeconds(long duration)
Syntax
TimeUnit.toSeconds(long duration) has the following syntax.
public long toSeconds(long duration)
Example
In the following code shows how to use TimeUnit.toSeconds(long duration) method.
import java.util.concurrent.TimeUnit;
/* w ww .j a v a 2 s .c o m*/
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.toSeconds(1));
}
}