如果我尝试replace(“ st”,“”)以便出现URLjava.text.ParseException:无法解析的日期:“ 1979年8月16日”
请帮助....
DateFormat originalFormat = new SimpleDateFormat("MMMM dd, yyyy", Locale.ENGLISH);
DateFormat targetFormat = new SimpleDateFormat("yyyyMMdd");
Date date = originalFormat.parse("August 21st, 2012");
String formattedDate = targetFormat.format(date);
MMMM
格式应提供完整的月份名称。尝试使用Locale.US
。