Creates a method and deposed saves the information in the bank:
public InformacaoArquivo verificarDataModificacao(String nomeArquivo) throws IOException {
Path file = new File("C:\\text\\"+nomeArquivo).toPath();
BasicFileAttributes attr = Files.readAttributes(file, BasicFileAttributes.class);
InformacaoArquivo info = new InformacaoArquivo(attr.creationTime().toString(), attr.lastAccessTime().toString(), attr.lastModifiedTime().toString() );
System.out.println("hora de criação: " + attr.creationTime());
System.out.println("último acesso: " + attr.lastAccessTime());
System.out.println("última modifição: " + attr.lastModifiedTime());
return info;
}
public class InformacaoArquivo {
private String horaCriacao;
private String ultimoAcesso;
private String ultimaModificao;
public InformacaoArquivo(String horaCriacao, String ultimoAcesso, String ultimaModificao) {
this.horaCriacao = horaCriacao;
this.ultimoAcesso = ultimoAcesso;
this.ultimaModificao = ultimaModificao;
}
You can use in a class and flame in your jsp
or if you see yourself wearing a controller
can do it as well and pass to jsp
Then you can convert the date to Date
and make comparison. all imports have to be from the package java.nio.*
;
Put the code snippet from your jsp view and controller(Servlet), corresponding to the error, would be better to understand your need.
– alxwca