Unparsable date exception

前端 未结 5 1214
我在风中等你
我在风中等你 2021-01-21 21:37

I\'m currently working on some simple project in Java and I have date in the following string:

String dateString = \"Sun 7/14 03:44 AM 2013\";
         


        
5条回答
  •  既然无缘
    2021-01-21 21:58

    Certain fields such as the day of week fields and/or AM/PM marker may not match those from your default Locale. ParseException has the method getErrorOffset to determine exactly where the pattern does not match.

    try

    DateFormat format = 
                    new SimpleDateFormat("EEE M/dd hh:mm a yyyy", Locale.ENGLISH);
    

提交回复
热议问题