2
I have a Table View, which receives the data of a table in my Database, until then I was able to bring the data normally, but the date is different from the one registered in the database, always behind 1 day before.
For example:
In the bank: 2018-09-06 In my Tableview returns: 2018-09-05
What could be causing this mistake?
Some data on how I am declaring the date:
import java.util.Date;
private Date datavisita;
public Date getDatavisita() {
return datavisita;
}
public void setDatavisita(Date datavisita) {
this.datavisita = datavisita;
}
//metodo para filtrar a data:
v.setDatavisita(rs.getDate(“datavisita”));
//declaração da coluna data
@FXML
TableColumn<VW_Visitas_Sonho, Date> colData;
// configurar as colunas de acordo com o objeto VW_Visitas_Sonho
colData.setCellValueFactory(new PropertyValueFactory<>(“datavisita”));
When you print out the dates they are correct?
– Gustavo Fragoso
In the bank are correct, when I show in my tableview always comes with 1 less day, another curiosity, I have 1 filter per date, when filter by today’s date for example, 13/09/2018, it brings me the corresponding date that is 12/09/2018.
– Thiago Belizário
I believe there is a problem between java.sql.Date (the one coming from the database) and java.util.Date, it is not necessarily a problem in Tableview because it only displays the saved information.
– Gustavo Fragoso
What do you tell me to do to solve this problem? I’m not sure what to do
– Thiago Belizário