Java FileTime.toMillis()

Syntax

FileTime.toMillis() has the following syntax.

public long toMillis()

Example

In the following code shows how to use FileTime.toMillis() method.


//from  w  w  w .  j  a  v  a2  s .co  m
import java.nio.file.attribute.FileTime;

public class Main {

  public static void main(String[] args) throws Exception {

    long time = System.currentTimeMillis();
    FileTime fileTime = FileTime.fromMillis(time);
        System.out.println(fileTime.toMillis());

  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.nio.file.attribute »




BasicFileAttributes
BasicFileAttributeView
DosFileAttributes
FileTime
PosixFileAttributes
PosixFilePermissions