The problem is the missing offset in the String that you are trying to parse to an OffsetDateTime. An OffsetDateTime cannot be created without a ZoneOffset but no ZoneOffset can be derived from this String (one could just guess it's UTC, but guessing is not suitable in such a situation).
You can parse the String to a LocalDateTime (a representation of a date and a time of day without a zone or an offset) and then add / attach the desired offset. You don't even need a custom DateTimeFormatter because your String is of ISO format and can be parsed using the default built-in formatter:
fun main() { // example String val givenDateString = "2020-09-22T20:35:00" // determine the zone id of the device (you can alternatively set a fix one here) val localZoneId: ZoneId = ZoneId.systemDefault() // parse the String to a LocalDateTime val localDateTime = LocalDateTime.parse(givenDateString) // then create a ZonedDateTime by adding the zone id and convert it to an OffsetDateTime val odt: OffsetDateTime = localDateTime.atZone(zoneId).toOffsetDateTime() // get the time in epoch milliseconds val timeInMillis = odt.toInstant().toEpochMilli() // and print it println("$odt ==> $timeInMillis") }
this example code produces the following output (pay attention to the trailing Z in the datetime representation, that's an offset of +00:00 hours, the UTC time zone, I wrote this code in the Kotlin Playground and it seems to have UTC time zone ;-) ):
2020-09-22T20:35Z ==> 1600806900000
Please note that I tried this with java.time and not with the ThreeTen ABP, which is obsolete to use for many (lower) Android versions now, since there's Android API Desugaring. However, this shouldn't make a difference because your example code threw exactly the same exception when I tried it first, which means ThreeTen is not to blame for this.