Java tutorial
import java.nio.file.attribute.FileTime; import java.util.concurrent.TimeUnit; public class Main { public static void main(String[] args) throws Exception { long time = System.currentTimeMillis(); FileTime fileTime = FileTime.fromMillis(time); System.out.println(fileTime.to(TimeUnit.HOURS)); } }