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

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -