I am using Joda-Time library to convert my String dates to a real date, because this seemed like the easiest solution to do this. I am using the DateTime object to do this;
new DateTime(strValue);
But when inserting some formats it throws me the exception;
java.lang.IllegalArgumentException: Invalid format: "Mon, 30 Sep 2002 01:56:02 GMT"
java.lang.IllegalArgumentException: Invalid format: "Sun, 29 Sep 2002 19:59:01 GMT"
java.lang.IllegalArgumentException: Invalid format: "Mon, 30 Sep 2002 01:52:02 GMT"
java.lang.IllegalArgumentException: Invalid format: "Sun, 29 Sep 2002 17:05:20 GMT"
java.lang.IllegalArgumentException: Invalid format: "Sun, 29 Sep 2002 19:09:28 GMT"
java.lang.IllegalArgumentException: Invalid format: "Sun, 29 Sep 2002 15:01:02 GMT"
java.lang.IllegalArgumentException: Invalid format: "Sun, 29 Sep 2002 23:48:33 GMT"
java.lang.IllegalArgumentException: Invalid format: "Sun, 29 Sep 2002 17:24:20 GMT"
java.lang.IllegalArgumentException: Invalid format: "Sun, 29 Sep 2002 11:13:10 GMT"
Is there a way to solve this, or should I use something else instead of DateTime.
That constructor is not some kind of universal date-time string interpreting engine. It expects variants of a regular ISO date defined as
YYYY-MM-DDTHH:MM:SS.SSSZ.You will need to define a format string that describes your format that can then be parsed from. It would be something like
EEE, dd MMM YYYY HH:mm:ss zzzjavadoc here!