23/12/2013 is mapping with MM/dd/yyyy format why, why not ParseException

后端 未结 5 553
野性不改
野性不改 2021-01-28 10:20

Can anybody help?

public void dateCalender() throws ParseException{
        System.out.println(new SimpleDateFormat(\"MM/dd/yyyy\", Locale.ENGLISH).parse(\"120/1         


        
5条回答
  •  不思量自难忘°
    2021-01-28 10:47

    You are using the format MM/dd/yyyy .So its taking Two positions

    U try this way:

    System.out.println(new SimpleDateFormat("MMM/dd/yyyy", Locale.ENGLISH).parse("Jan/12/2013").toString());

    Here not throws unparsable exception but am not shoore about that is working or not

    I think this will be wrong way every time using only MM/dd/yyyy format as "1/12/2013"

提交回复
热议问题