import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.attribute.BasicFileAttributes; public class Main { /** * @param args * @throws IOException */ public static void main(String[] args) throws IOException { Path p1 = Paths.get("C:\\Users\\User\\Desktop\\Desk"); BasicFileAttributes att = Files.readAttributes(p1, BasicFileAttributes.class); System.out.println("Size: " + att.lastModifiedTime()); } }
time is retured as GMT format.
what should i do to return it to GMT+4 etc?
and lastAccessTime() is also not showing correct time. I modified a file then chcked it lastModifiedtime(). it shows the current time(GMT) but when i System.out the lastAccesstime() it shows the wrong time..