java - Unparsable date exception MM/dd/yyy hh:mm:ss a z -


     string inputstr = "05/01/2012 10:51:47 am pdt";      string inputfmt = "mm/dd/yyyy hh:mm:ss z";      simpledateformat dflong = new simpledateformat(inputfmt);;      date localmodifieddate = dflong.parse(inputstr);      system.out.println(localmodifieddate); 

gives me unparsable date exception

your default locale may not capable of parsing am/pm marker and/or timezone. try english locale:

simpledateformat dflong = new simpledateformat(inputfmt, locale.english); 

Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

What is the difference between data design and data model(ERD) -

ios - Can NSManagedObject conform to NSCoding -