2
Answers

How to convert date formt from MM/dd/yyyy to yyyy/MM/dd ?

Venkatesh K H

Venkatesh K H

7y
384
1
I am sending MM/dd/yyyy format from frontend to the mysql workbench database but its not storing the date as  MM/dd/yyyy format. then how to convert this to yyyy/MM/dd in jsp.
I have tried this code but getting error please reply soon its urgent.
<%String start_date = "MAY-08-2017";
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
Date d = formatter.parse(start_date);
System.out.println(d);
System.out.println(formatter.format(d));%>
Answers (2)