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
Post a Comment