I'm trying to return a date that is recorded right in the bank (1986-04-30 17:02:00), I try to convert this date to appear only "04/30/1986", but it's no use.
The most I get back is Wed Apr 30 00:00:00 BRT 1986.
To create the list with Hibernate.
public List<Fornecedor> listarFornecedores() {
session = HibernateUtil.getSessionFactory().openSession();
List<Fornecedor> listaFornecedores = new ArrayList<Fornecedor>();
query = session.createQuery("FROM Fornecedor");
listaFornecedores = query.list();
session.close();
return listaFornecedores;
}
and in the Get from the vendors class I tried everything, but I get to the maximum up to this point without giving error:
public Date getInicioAtividades() throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
String data = sdf.format(inicioAtividades);
Date dataI = sdf.parse(data);
return dataI;
}
If it were to return a string, everything legal, with SimpleDataFormat
is right, however, I would like to return a Date. Can someone give me strength?