Frage

Currently i have my code as

bean.setREPO_DATE(row.getCell(16).getDateCellValue());

it works fine if cell is formatted as date in excel.

However it also converts some integer or long like 1234 or 5699 to date. I know the reason behind this too.

However i want to apply a check before executing above line. Something like this

if(row.getCell(16).isOfDateFormat){
bean.setREPO_DATE(row.getCell(16).getDateCellValue());
} 

Please Guide me..

Thanks in Advance !

War es hilfreich?

Lösung

Try this,

use import org.apache.poi.ss.usermodel.DateUtil;

if(DateUtil.isCellDateFormatted(cell))
   {
       cell.getDateCellValue();
   }
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top