Unparseable date +01:00 groovy

361 Views Asked by At

How to parse this date format? 2019-05-14T15:07:19.000+01:00

I have used "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" but I am getting an unparseable date error.

have also tried these: yyy-MM-dd'T'HH:mm:ss.SSSZZ

"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"

yyyy-MM-dd'T'HH:mm:ss.SSSXXX

but these also have unparseable date error.

Any help would be much appreciated. Thanks :)

Below is the error seen. Error executing data process; Caused by: Error executing data process; Caused by: Unparseable date: "2019-05-14T15:07:19.000+01:00" (in groovy2 script); Caused by: Unparseable date: "2019-05-14T15:07:19.000+01:00"

1

There are 1 best solutions below

1
tim_yates On

If you're running on top of Java 8, you can use ZonedDateTime to parse this by simply:

import java.time.ZonedDateTime

ZonedDateTime.parse("2019-05-14T15:07:19.000+01:00")