java - String to Date conversion returning wrong value -
i trying convert string date... return value wrong.
string startdate = "2013-07-24"; date date = new date(); try{              dateformat formatter = new simpledateformat("yyyy-mm-dd");      date = (date)formatter.parse(startdate);     system.out.println(date);     } catch(exception e){     e.printstacktrace(); } the desired output is:
thu jul 25 00:00:00 cdt 2013
but actual output is:
fri jan 25 00:00:00 cst 2013
how month becomes jan july?
change dd dd;
dateformat formatter = new simpledateformat("yyyy-mm-dd");  
Comments
Post a Comment