读写操作
try (FileReader fileReader = new FileReader("读的文件路径");
BufferedReader br = new BufferedReader(fileReader);
FileWriter fileWriter = new FileWriter("写的文件路径");
BufferedWriter bw = new BufferedWriter(fileWriter);
){
String string = null;
string =br.readLine();
//DateUtil.string2UtilDate()
while (string != null) {
// String[] strings = string.split(",");
//
// Date startDate = DateUtil.string2UtilDate(strings[0]);
// Date endDate = DateUtil.string2UtilDate(strings[1]);
//
//计算两个日期之间的差,单位是天数
// int cha =(int) ((endDate.getTime() - startDate.getTime())/(24*60*60*1000));//强制类形转换将除结果变为int
// System.out.print(string+",");
// bw.write(string+","+cha);
// string =br.readLine();
// if (string == null) {
// System.out.print(cha);
// }else {
// System.out.println(cha);
// bw.newLine();
// }
string =br.readLine();
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Calendar中的after(Object) 方法传入参数虽为Object类型,但是实例必须是Calendar