How do I convert timestamps in ISO 8601 format with an offset-from-UTC to EpochMilli in Java/Scala
14:32 22 Jul 2018

I have strings in ISO 8601 format with timezone offset. They are in the format "2017-05-21T20:37:08.021-05:00". I want to convert to EpochMilli in Java/Scala.

Instant.parse( "2017-05-21T20:37:08.021-05:00" ).toEpochMilli()

gives me the error java.time.format.DateTimeParseException: Text '2017-05-21T20:37:08.021-05:00' could not be parsed at index 23

java scala