There can be two different date time formats as shown below. The second variant has milliseconds time.
2020-09-07T16:15:42Z
2020-09-09T11:41:58.5152Z
Currently i am using this way to parse the date. Is there a way to specify a single format to account for both of these two cases?
def dateutc = (new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSS'Z'"))
dateutc.setTimeZone(TimeZone.getTimeZone("UTC"))
time = dateutc.parse(point.time.toString()).getTime()
Thanks for the help!
Please note i am using java 7.