convert string into date format in java

前端 未结 3 1467
傲寒
傲寒 2021-01-24 16:50

I want to convert this string to the following date format.

  String s = \"2-26-2013\";
  Date date = new SimpleDateFormat(\"EEEE, MMMM/dd/yyyy\").parse(s);
  Sy         


        
3条回答
  •  不思量自难忘°
    2021-01-24 17:28

    Instead of using MMMM/dd/yyyy you need to used MM-dd-yyyy. SimpleDateFormat expects the pattern to match what its trying to parse.

提交回复
热议问题