java - Convert string with millisecond and timezone to Date -
i have string in format: 2017-04-06t09:29:12.225z
i need in date format tried with:
private date convertstringtodate(string datestring) { simpledateformat dateformat = new simpledateformat("yyyy-mm-dd't'hh:mm:ss.sssz"); date converteddate = new date(); try { converteddate = dateformat.parse(datestring); } catch (parseexception e) { // todo auto-generated catch block e.printstacktrace(); } return converteddate; }
but showing unparsable error?
try
simpledateformat dateformat = new simpledateformat("yyyy-mm-dd't'hh:mm:ss.sss'z'");
Comments
Post a Comment