android - SimpleDateFormat - Strange IllegalArgumentException -
i've got problem simpledateformat. i'm given string date this:
"2013-05-17 10:15:44"
and try parse this:
simpledateformat simpledateformat = new simpledateformat("yyyy-mm-dd hh:mm:ss"); simpledateformat.settimezone(timezone.gettimezone("utc")); string formatteddate = simpledateformat.format(s2);
but last line throws me illegalargumentexception. wrong it? doesn't make sense me.
that's not how dateformat works: used switch between strings , dates. have 2 basic operations:
date date = format.parse(somestring); //from string date string str = format.format(date); //from date string
in case, suspect wanted do:
date date = simpledateformat.parse(s2);
Comments
Post a Comment