posted 17 years ago Hi,
I am trying to convert the date string to date format but it showing exception.I am copying my code below which i have written for conversion of a string to date format.
=====code starts here====
String myDate="Thu Dec 27 11:08:58 IST 2007";
java.text.SimpleDateFormat targetDateFormat = new java.text.SimpleDateFormat("(D) (M) (DD) (hh:mm:ss) (yyyy)");
java.util.Date d2 = now1.parse(myDate);
System.out.println("==============" +d2);
====code ends here=======
=====exception is ====
java.text.ParseException: Unparseable date: "Thu Dec 27 11:08:58 IST 2007"
at java.text.DateFormat.parse(Unknown Source)
(TestDate.java:113)
=======
I need the same format for the date ie only data type should be changed i.e output date will be Thu Dec 27 11:08:58 IST 2007.
Please help me to solve this problem.
Regards
Sanjeev