Joda String DateTime to DateTime
im trying to convert a DateTime string which is passed like below
"2013-08-14T12:54:57.908+05:30"
my converter function looks like this:
public static DateTime stringDateToJodaDateTime(String strDate){
DateTimeFormatter formatter = DateTimeFormat.forPattern("EEE, dd MMM YYYY HH:mm:ss Z");
DateTime jodaDateTime = formatter.parseDateTime(strDate);
return jodaDateTime;
}
it gives me below error
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.sun.faces.vendor.WebContainerInjectionProvider.invokeAnnotatedMethod(WebContainerInjectionProvider.java:113)
... 88 more
Caused by: java.lang.IllegalArgumentException: Invalid format: "2013-08-14T12:54:57.908+05:30"
at org.joda.time.format.DateTimeFormatter.parseDateTime(DateTimeFormatter.java:899)
at com.kpowd.utility.UserUtility.stringDateToJodaDateTime(UserUtility.java:65)
at com.kpowd.controller.CommonChartController.init(CommonChartController.java:51)
... 93 more
which I think is due to the wrong "forPattern", I cannot change the DateTime Pattern string that is being passed. all i can do is change "DateTimeFormat.forPattern" help me
+3
source to share