I have time as a "2011-12-03 12:00:19" how to convert it in "Fri 2 December 2011 " ,I know this http://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html ,But gives me Error:
Exception in thread "main" java.lang.IllegalArgumentException: Cannot format given Object as a Date
at java.text.DateFormat.format(Unknown Source)
at java.text.Format.format(Unknown Source)
at com.timestamp.NewTimeStamp.<init>(NewTimeStamp.java:21)
at com.timestamp.NewTimeStamp.main(NewTimeStamp.java:35)
My code is ::
String mytime ="2011-12-03 12:00:19";
String pattern = "EEE d MMMMM yyyy";
SimpleDateFormat dateFormat = new SimpleDateFormat(pattern);
Date date = new Date(mytime);
String time = dateFormat.format(date);
System.out.println("=== > " + time);