I am trying to convert date which is in string and got format of \"yyyy-MM-dd HH:mm:ss\" to \"dd-MM-yyyy\".
I have implmented following code but its giving : java.
First you have to parse the string representation of your date-time into a Date object.
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = (Date)formatter.parse("2011-11-29 12:34:25");
Then you format the Date object back into a String in your preferred format.
DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy");
String mydate = dateFormat.format(date);