i'm trying to convert my date which is in string form to date
my code :
String dtStart = passedDate+" "+passedTme; // here my time is : 28/08/16 2:00 pm
System.out.println(dtStart);
SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy HH:mm a");
try {
Date date = format.parse(dtStart);
System.out.println(date); // and result output is : Fri Aug 28 00:00:00 GMT+05:30 16
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
the above is taking 28/08/16 2:00 pm
and returning Fri Aug 28 00:00:00 GMT+05:30 16
.
anyone can point out why my output is not correct here ??
SOLVED
required format was this : SimpleDateFormat("dd/MM/yy h:mm a")
.