java.text.ParseException:不可解析的日期:“ 1979年8月16日”

问题描述 投票:-4回答:1

如果我尝试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);  
java date format simpledateformat date-formatting
1个回答
0
投票

MMMM格式应提供完整的月份名称。尝试使用Locale.US

© www.soinside.com 2019 - 2024. All rights reserved.