Java Date将dd-MMM-yyyy转换为dd MMMMMMMMMM yyyyy?

sur*_*190 -2 java android date

以下方法返回日期示例:

2015年3月11日

代替:

2015年3月11日

码:

public static String convertDat(String s) throws ParseException {
    SimpleDateFormat converted = new SimpleDateFormat("dd MMMMMMMMMMMMMMMMMMMM yyyy ");
    SimpleDateFormat incoming = new SimpleDateFormat("dd-MMM-yyyy");
    Date currentDate = (Date) incoming.parse(s);
    return converted.format(currentDate);
}
Run Code Online (Sandbox Code Playgroud)

Rav*_*yal 6

DateFormat应该是这样的

SimpleDateFormat converted = new SimpleDateFormat("dd MMMM yyyy");
Run Code Online (Sandbox Code Playgroud)

来自SimpleDateFormat文档

M月份
M:1 MM:01 MMM:Jan MMMM:1月 MMMMM:J