28 Ocak 2018 Pazar

FileTime Sınıfı

toInstant metodu
Java 8 ile geliyor. Elimizde şöyle bir kod olsun.
FileTime t = Files.getLastModifiedTime(path);
Şöyle yaparız.
Instant fileInstant = t.toInstant();
Instant now = clock.instant(); // Where clock is a java.time.Clock, for testability
Duration difference = Duration.between(fileInstant, now);
long days = difference.toDays();

Hiç yorum yok:

Yorum Gönder