1

Getting a DateTimeParseExcpetion when trying to convert a String 2019-08-13T07:29:12.000+0000 into an OffsetDateTime. The String comes from SalesForce

OffsetDateTime.parse("2019-08-13T07:29:12.000+0000", DateTimeFormatter.ISO_LOCAL_DATE_TIME.withZone(ZoneId.systemDefault()))
1

1 Answer 1

3

You could use a custom formatter matching to the specific format provided by Salesforce. In this case, you could try as shown below

 DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
 OffsetDateTime.parse("2019-08-13T07:29:12.000+0000", formatter);

More details about formatter could be found https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.