String to date (Invalid format)
Posted
by MrThys
on Stack Overflow
See other posts from Stack Overflow
or by MrThys
Published on 2010-06-10T07:30:35Z
Indexed on
2010/06/10
7:32 UTC
Read the original article
Hit count: 374
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.
© Stack Overflow or respective owner