How can this 11/03/2009-20:06:16 to a Date object so I can compare two dates. I keep getting java.lang.IllegalArgumentException: Cannot format given Object as a Date error if I use below implementation.. I need the output to be date object with format Tue Jul 14 01:32:31 2009
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class Dateaf {
/**
* @param args
* @throws ParseException
*/
public static void main(String[] args) throws ParseException {
// TODO Auto-generated method stub
String text = "11/03/2009-20:06:16";
SimpleDateFormat dateParser = new SimpleDateFormat("MM/dd/yyyy-hh:mm:ss");
Date date = dateParser.parse(text);
System.out.println(date);
}
}