DateFormat formatter = new SimpleDateFormat(\"MM/dd/yyyy\' \'HH:mm:ss\");
Date d = (Date)formatter.parse(dateTime);
System.out.println(\"date in controller \"+d);
>
You are using d
an object of Date
class, so its toString
method is called that gives the output as Mon Dec 31 16:04:57 IST 2012
.
If you want to display it in the format that you have specified in your SimpleDateFormat
then try using this :
DateFormat formatter = new SimpleDateFormat("MM/dd/yyyy' 'HH:mm:ss");
Date d = (Date)formatter.parse(dateTime);
System.out.println("date in controller "+ formatter.format(d));