0

My Java is connected to a MySQL database using Spring and Hibernate. I have a datetime column with the YYYY-MM-DD HH:mm:ssformat.

@Column(name="creation_date_time")
@NotNull
private Date creationDateTime;

I have to send response with ISO 8601 standards. What would be the best choice? I was thinking about parsing the date into a string and then using Joda Time but it looks quite contstraining. Thanks

ahbon
  • 502
  • 4
  • 19
  • You'd not _parse_ the date to a string but _format_ it. That said have a look at `SimpleDateFormat`. – Thomas Jun 01 '16 at 15:37
  • `java.util.Date`, `SimpleDateFormat`, and the other old date-time classes are now legacy, supplanted by the [java.time](https://docs.oracle.com/javase/8/docs/api/java/time/package-summary.html) framework built into Java 8 and later. The java.time classes use the standard [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) formats when parsing and generating strings. – Basil Bourque Jun 01 '16 at 17:28

0 Answers0