次のような値があり、Mon Jun 18 00:00:00 IST 2012
これをに変換したい18/06/2012
これを変換する方法は?
この方法を試してみました
public String toDate(Date date) {
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
Date theDate = null;
//String in = date + "/" + month + "/" + year;
try {
theDate = dateFormat.parse(date.toString());
System.out.println("Date parsed = " + dateFormat.format(theDate));
} catch (ParseException e) {
e.printStackTrace();
}
return dateFormat.format(theDate);
}
しかし、それは次の例外をスローします:
java.text.ParseException: Unparseable date: "Mon Jun 18 00:00:00 IST 2012"