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

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -