I need to get the actual date and minus the date from the value in the database, the date now is now
and the date in the database is this.vencimento
.
public boolean getDiasVencido() {
boolean diasvencido = false;
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
Date datahora = null;
try {
datahora = (Date) formatter.parse(this.vencimento);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Date now = new Date();
if(datahora.compareTo(now) < 0 ) {
long diff = "DATE NOW - DATE FROM DATABASE (this.vencimento)";
long days = diff / (24 * 60 * 60 * 1000);
diasvencido = true;
}
return diasvencido;
}
the variables setted in the class:
public class classetitulo {
private String documento;
private String vencimento;
private Double valor;
private Double multa;
private Double juros;
public classetitulo() {}
public classetitulo(String documento, String vencimento, Double valor, Double multa, Double juros) {
this.documento = documento;
this.vencimento = vencimento;
this.valor = valor;
this.juros = juros;
this.multa = multa;
}
I don't know much how to do it. thanks in advance.