I'd like Play!Framework to convert a Timestamp sent via POST into a java.util.Date format in the Model, but I don't know if it's directly possible.
Here's my model :
public class Contact extends Model {
@Id
private Long id;
@Constraints.Required
private String name;
@JsonIgnore
@Temporal(TemporalType.TIMESTAMP)
private Date removed = null; // When the contact is no longer active
}
I tried to add @Formats.DateTime(pattern="?")
to removed, but since DateTime use SimpleDateFormat, I wasn't able to found which pattern to use to convert a timestamp to the correct Date.
How can I do ?