I have such string which can be formatted like this (depending on timezone, so e.g):
"2018-10-17T15:33:15 UTC"
"2018-10-17T17:03:00 Europe/Praga
"2018-10-18T12:00:00 America/Kentucky/Monticello"
So those strings contains Zone id at the end
How to parse such strings to datetime?
What I was trying:
val dateString = "2018-10-18T12:00:00 America/Kentucky/Monticello"
ISODateTimeFormat
.dateTimeParser()
.parseDateTime(dateString)
UPDATE:
I've also tried:
val simpleDateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss zzzz")
val parsed: Date = simpleDateFormat.parse(dateString)
But it cannot be parsed