I am taking the date as input from JSP and then I need to store in the database using hibernate. my date format is also correct but still, it's not working. Here is my code:
String dateStr = request.getParameter("receive_date");
DateFormat formatter = new SimpleDateFormat("E MMM dd HH:mm:ss Z yyyy");
Date date = (Date)formatter.parse(dateStr);
System.out.println(date);
Calendar cal = Calendar.getInstance();
cal.setTime(date);
String formatedDate = cal.get(Calendar.DATE) + "/"+ (cal.get(Calendar.MONTH) + 1) + "/" + cal.get(Calendar.YEAR);
out.println("formatedDate : " + formatedDate);