0

I am trying for many hours to parse this date String which is returned by Shodan. "2019-02-23T13:59:13.312401" ISO format is throwing exception.

java.lang.IllegalArgumentException: Invalid format: "2019-02-14T10:16:35.313860" is too short
    at org.joda.time.format.DateTimeFormatter.parseDateTime(DateTimeFormatter.java:945)

I am using Joda DateTime library with Google Gson. Anyone knows which format is this and how can I convert it to DateTime object from String.?

AZ_
  • 21,688
  • 25
  • 143
  • 191
  • Possible duplicate of [Converting ISO 8601-compliant String to java.util.Date](https://stackoverflow.com/questions/2201925/converting-iso-8601-compliant-string-to-java-util-date) – AZ_ Feb 26 '19 at 08:25

1 Answers1

1

Shodan stores the timestamps in ISO 8601 format which you can read more about here:

https://docs.python.org/2/library/datetime.html#datetime.datetime.isoformat

And see here for a previous answer on parsing the format using Joda time:

Converting ISO 8601-compliant String to java.util.Date

achillean
  • 520
  • 4
  • 10