android - String from\to GregorianCalendar cause java.text.ParseException: Unparseable date -
i need convert gregoriancalendar string , reconvert string gregoriancalendar again
i use convert string in gregoriancalendar
dateformat format = new simpledateformat(); date date = null; try { date = format.parse(dates); } catch (parseexception e) { e.printstacktrace(); } gregoriancalendar cal = new gregoriancalendar(); cal.settime(date); unfortunately when invoke second method error
java.text.parseexception: unparseable date: "11 apr 2014 21:48:02" (at offset 2) at line
date = format.parse(dates);
you need instantiate simpledateformat object pattern use parse date string. in case:
dateformat format = new simpledateformat("d mmm yyyy hh:mm:ss"); a table of acceptable pattern symbols can found in docs simpledateformat
Comments
Post a Comment