How to Format ISO-8601 in Java

A java.time.LocalDate is “a date without a time-zone in the ISO-8601 calendar system, such as 2007-12-03” so there is not enough information there. Use java.time.ZonedDateTime instead.

Also, swallowing exceptions like that makes it much harder to troubleshoot. When you don’t intend to handle an exception either don’t catch it at all, catch and re-throw it wrapped in a RuntimeException or at the very least log it (e.printStackTrace() or similar) .

Leave a Comment