Java FileTime create from milliseconds

Description

Java FileTime create from milliseconds

import java.nio.file.attribute.FileTime;

public class Main {

   public static void main(String[] args) {

      FileTime fileTime = FileTime.fromMillis(1000L * 60 * 60 * 24 * 1000);
      System.out.println(fileTime);

   }/*  w ww  .  j  ava 2  s  .  com*/

}
import java.nio.file.attribute.FileTime;
import java.time.Instant;
import java.util.concurrent.TimeUnit;

public class Main {
  public static void main(String[] args) {
     long time = System.currentTimeMillis();
     FileTime fileTime = FileTime.from(time, TimeUnit.MILLISECONDS);
     System.out.println(fileTime);
     //from ww  w . ja v a  2  s  . co m
  }
}



PreviousNext

Related