Simple Date Format for string

Some Java Guy picture Some Java Guy · Jul 23, 2012 · Viewed 9.7k times · Source

I have my current data as 2012-08-20T12:30:00+05:30

  DateTime currentdata = "2012-08-20T12:30:00+05:30";

I am using

 String myDate = new SimpleDateFormat("MM/dd/yyyy").format(currentdata);

I get Cannot format given Object as a Date

Any clues??

Answer

AxxA Osiris picture AxxA Osiris · Jul 23, 2012
String myDate = new SimpleDateFormat("MM/dd/yyyy").format(currentdata.toDate());