Venkatesh K H

Venkatesh K H

  • 1.8k
  • 116
  • 19.6k

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

May 17 2017 3:25 AM
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));%>

Brought to you by: JavaScript SDK for Bold BI dashboard and analytics embedding. Free trial.

Answers (2)