Java FileTime.from(long value, TimeUnit unit)

Syntax

FileTime.from(long value, TimeUnit unit) has the following syntax.

public static FileTime from(long value,  TimeUnit unit)

Example

In the following code shows how to use FileTime.from(long value, TimeUnit unit) method.


import java.nio.file.attribute.FileTime;
import java.util.concurrent.TimeUnit;
//from  w w  w  .j av  a2s  .c  om
public class Main {

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

    long time = System.currentTimeMillis();
    FileTime fileTime = FileTime.from(time,TimeUnit.MILLISECONDS);
    System.out.println(fileTime);

  }
}

The code above generates the following result.





















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




BasicFileAttributes
BasicFileAttributeView
DosFileAttributes
FileTime
PosixFileAttributes
PosixFilePermissions