1
I have the following date generated in Angularjs: 2015-09-14T18:38:03.637Z
when I try to give a POST the following error happens in the backend:
Caused by: java.text.Parseexception: Unparseable date: "2015-09-14T18:38:03.637Z" at java.text.Dateformat.parse(Unknown Source) at br.com.Caelum.vraptor.serialization.gson.Dategsonconverter.deserialize(Dategsonconverter.java:59) ... 56 more
At the angle I do as follows: contato.data = new Date();
the attribute that will receive that date in backend
is the type Java.util.Date
. I’ve tried that way:
contato.data = $filter('date')(new Date(), 'yyyy-MM-dd');
But it didn’t work. How can I convert this date?
Method that makes the POST:
@Post
@Path(value = "/salvar")
@Consumes(value = "application/json", options = WithoutRoot.class)
public void salvar(Contato contato) {
System.out.println("Empresa: " + contato.getNome());
contatoDAO.salvar(contato);
}