convert String "11-10-10 12:00:00" into Date Object
- by Mahendra Athneria
Hi,
I want to convert String "11-10-10 12:00:00" into Date object but i am not able to do so.
can you please help me out?
below is the code snippet.
i have the Date obj which has the value = Mon Oct 11 00:00:00 IST 2010
DateFormat newDateFormat = new SimpleDateFormat("dd-MM-yy hh:mm:ss");
String strDate = newDateFormat.format(tempDate);
//**i got strDate as strDate is : 11-10-10 12:00:00**
DateFormat newDateFormat1 = new SimpleDateFormat("dd-MM-yy hh:mm:ss");
try {
tempDate = newDateFormat1.parse(strDate);
// **getting tempDate as - Mon Oct 11 00:00:00 IST 2010**
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Can someone help me to solve this issue?
Regards,
Mahendra Athneria
Mumbai, India