Java IO Tutorial - 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 a 2 s .  c  o m
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.