1

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 Answers1

1

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")
tim_yates
  • 167,322
  • 27
  • 342
  • 338
  • Since the string contains an offset (+01:00) and no time zone (like Europe/London, for example), it’s even better to use `OffsetDateTime` than `ZonedDateTime`. – Ole V.V. May 22 '19 at 14:59