List of usage examples for java.nio.file.attribute FileTime to
public long to(TimeUnit unit)
From source file:Main.java
public static void main(String[] args) throws Exception { long time = System.currentTimeMillis(); FileTime fileTime = FileTime.fromMillis(time); System.out.println(fileTime.to(TimeUnit.HOURS)); }
From source file:com.att.aro.core.fileio.impl.FileManagerImpl.java
public long getCreatedTime(String filePath) throws IOException { File file = new File(filePath); FileTime fileTime = (FileTime) Files.getAttribute(file.toPath(), "creationTime", LinkOption.NOFOLLOW_LINKS); if (fileTime != null) { return fileTime.to(TimeUnit.SECONDS); }//w w w. j a va 2 s . c o m return 0; }