【发布时间】:2018-06-19 22:47:21
【问题描述】:
我会直截了当,我的目标如此改变
2018-05-24
进入
2018 年 5 月 24 日。
这是我当前的代码:
String content = "2018-05-24";
SimpleDateFormat old = new SimpleDateFormat("yyyy-mm-dd");
Date oldDate = old.parse(content);
SimpleDateFormat current = new SimpleDateFormat("MMMM dd, yyyy.");
String newDate = current.format(oldDate);
System.out.println(newDate);
但运行会产生:
2018 年 1 月 24 日。
我不知道为什么这会告诉我一月。我知道我错了,我在 StackOverFlow 上搜索过类似的问题,但也许我做的不对。有什么建议吗?
【问题讨论】:
标签: java date simpledateformat