I need to take date in the format date/month/year hours:minutes (time in 12 hour format) in java and I write the following code to save the date in datetoday. But it does not work for me. The output is shown in the following format Tue Nov 11 12:10:00 IST 2014. Can anyone help me regarding the issue? Thanks in advance.
Date datetoday;
void todaysdate() {
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("DD/MM/yyyy HH:mm");
String inputString2 = sdf.format(date);
try {
datetoday = sdf.parse(inputString2);
} catch (ParseException ex) {
System.out.println(ex.getMessage());
}
System.out.println(datetoday);
}