I am looking to convert the date from default Date format to timestamp in Java. I tried the following code, but it doesn't work:
String string = "2017-08-01T16:00:00-04:00";
DateTimeFormatter formatter =
DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss-mm:ss");
LocalDate date = LocalDate.parse(string, formatter);
System.out.println(date);
java.time.format.DateTimeParseException: Text '2017-08-01T16:00:00-04:00' could not be parsed at index 20
at java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:1949) at java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1851) at java.time.LocalDate.parse(LocalDate.java:400)