I want to input the dates from my excel file into the java program that I wrote. folllowing is the code I have prepared to do the same.
while(itr.hasNext()) {
Row row=itr.next();
Iterator<Cell> cellIterator=row.cellIterator();
while(cellIterator.hasNext()) {
Cell cell=cellIterator.next();
Cell name_cell=row.getCell(0);
String name=name_cell.getStringCellValue();
if (cell.getRowIndex()!=0 && cell.getStringCellValue().equals("")&& cell.getColumnIndex()!=0){
int idate=cell.getColumnIndex();
Row first_row=sheet.getRow(0);
Cell date_cell=first_row.getCell(idate);
Date sdate=date_cell.getDateCellValue();
if (ExcelReader.DayCheck(sdate)){
System.out.println("No entry found for "+name+" on "+sdate);
}
}
}
}
System.out.println("");
}
The program needs to read an excel file in which the first row is filled with dates in dd-mm-yyyy format and create an identifier for the date fetched and store it for further programming.
the problem is that it shows dates as 00-00-0000. What is wrong in the code and how do I fix it?