java - String Date Value Converting -


i converting string date format. returns "unparseable date". example,

string date= "wednesday, may 15, 2013";

i want convert string "2013-05-15" how that?

use simpledateformat twice: once parse date, other render in desired format:

date date; string display = new simpledateformat("yyyy-mm-dd").format(         new simpledateformat("eeee, mmmm dd, yyyy").parse(date)     ); 

your example date unfortunate, because uses 3-letter month "may", can't tell if month names truncated 3 letters, or if full name. have assumed months full name, if truncated, change mmmm mmm in second format string.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -