Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
尝试使用 Joda 将 yyyy-MM-dd 格式转换为 MM-dd-yyyy。
无效格式:“2013-02-20”在“13-02-20”格式错误
String date = "2013-02-20"; DateTimeFormatter dft = DateTimeFormat.forPattern("MM-dd-yyyy"); DateTime d2 = DateTime.parse(date, dft);
输入模式与输入日期不匹配String。它应该是
String
String date = "2013-02-20"; DateTimeFormatter dft = DateTimeFormat.forPattern("yyyy-MM-dd"); DateTime d2 = DateTime.parse(date, dft); System.out.println(d2.toString("MM-dd-yyyy"));