java - convert string to joda datetime gets stuck -
i'm trying convert string: 2014-01-01 00:00:00 joda datetime
i have tried following:
public static datetime simpleiso8601stringtodatetime(string date) { datetimeformatter df = datetimeformat.forpattern(consts_app_general.simple_date_format); return df.parsedatetime(date); } and following:
public static datetime simpleiso8601stringtodatetime(string date) { datetime dtdate = datetime.parse(date, datetimeformat.forpattern(consts_app_general.simple_date_format)); return dtdate; } where
public static final string simple_date_format = "yyyy-mm-dd hh:mm:ss.sss"; however, using debugger formatting line , while trying process program cursor never comes back.
i should mention android project.
any ideas might problem?
it’s because 2014-01-01 00:00:00 doesn’t match pattern yyyy-mm-dd hh:mm:ss.sss—there’s no fractional part on seconds in input.
the result unhandled exception gets raised—i’m not familiar how android handles those, thread dies unless set handler. putting parse() call inside try block should let recover.
Comments
Post a Comment