java - convert string to date format error -
I want to change the string but the output date is different from the input date
string Date string = "04/01/2014"; Simple Format Format = New SimpleDormat ("MM / DD / YYYY"); Try {date date = format.parse (dateString); Println (date); } Grip (ParseException E) {// TODO self generated blocking block e.printStackTrace (); }
Output Sun Dec 29 00:00:00 EET 2013
< P> Your format string is incorrect, from -
D day in year 18 9
D day in the month of the month
And
y year year 1996; 96
Y week year 200 9; 09
So, you wanted -
string dateString = "04/01/2014"; Simple Format Format = New Simple Format ("MM / DD / Yay"); Try {date date = format.parse (dateString); Println (date); } Grip (ParseException E) {// TODO self generated blocking block e.printStackTrace (); }
Comments
Post a Comment