TimeUnit is an enumeration found in the java.util.concurrent package.
It represents a time duration as defined in the following table.
Enumeration Value | Meaning |
---|---|
NANOSECONDS | One thousandth of a microsecond |
MICROSECONDS | One thousandth of a millisecond |
MILLISECONDS | One thousandth of a second |
SECONDS | A second |
MINUTES | Sixty seconds |
HOURS | Sixty minutes |
DAYS | Twenty four hours |
import java.nio.file.attribute.FileTime; import java.util.concurrent.TimeUnit; public class Main { public static void main(String[] args) { FileTime fileTime = FileTime.from(1000, TimeUnit.DAYS); System.out.println(fileTime); }/*from w ww . ja va 2s .co m*/ }