Java SimpleDataFormat.parse返回无效的日期
我正在发送一个有效日期(“1705”)并获得不同的解析日期(“1701”) 有人帮我修什么吗? 中间的打印显示有效日期。Java SimpleDataFormat.parse返回无效的日期,java,simpledateformat,Java,Simpledateformat,我正在发送一个有效日期(“1705”)并获得不同的解析日期(“1701”) 有人帮我修什么吗? 中间的打印显示有效日期。 SimpleDateFormat sdf = new SimpleDateFormat("YYMM"); System.out.println(exYear+exMonth); Date ccDate = sdf.parse(exYear+exMonth); 年度的y必须在小范围内 SimpleDate
SimpleDateFormat sdf = new SimpleDateFormat("YYMM");
System.out.println(exYear+exMonth);
Date ccDate = sdf.parse(exYear+exMonth);
年度的
y
必须在小范围内
SimpleDateFormat sdf = new SimpleDateFormat("yyMM");
请参阅中的完整符号说明,因此这里的答案是:不要假设某个字符串具有特定的含义。先检查一下文档。