android Date parsing -
android Date parsing -
i have next string need parse date:
2012-01-31t08:41:12.5462495+01:00
now have tried next code doesn't work:
public static string format_date_iso = "yyyy-mm-dd't'hh:mm:ss.sssz"; public static date fromisodatestring(string isodatestring) throws exception { dateformat f = new simpledateformat(format_date_iso); f.settimezone(timezone.gettimezone("zulu")); homecoming f.parse(isodatestring); }
i assuming becase time zone should +0100 , in case +01:00.
how solve this? thanks.
there 2 problems:
the time zone specifier the precision of secondsi haven't found easy way prepare time zone specifier part in simpledateformat
, i'd tempted manipulate string - it's fixed length, it's not hard remove final colon. can utilize
"yyyy-mm-dd't'hh:mm:ss.sssssssz"
as format string. note according docs, joda time does handle time zone offsets using colons, that's option.
android date timezone
Comments
Post a Comment