poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John Lloyd" <llo...@us.ibm.com>
Subject Recognizing Dates
Date Wed, 12 Mar 2003 16:35:50 GMT
Hello,
I am writing code using HSSF to parse Excel spreadsheets. I would like to
recognize a cell as a date or not. I'm using the method shown in the code
below. However, I find this does not detect all date cells. For example
"MM/DD", "MM/DD/YY", and "<month> DD, YYYY" formats are not detected. Does
anyone know of a better way to determine if a cell contains a date?

Thanks,
John


HSSFCell cell = row.getCell(i);
switch (cell.getCellType()) {
      case HSSFCell.CELL_TYPE_NUMERIC:
            if (HSSFDateUtil.isCellDateFormatted(cell) == true) {
                  // do date stuff
            }
            break;
}

Email  * lloydj@us.ibm.com
Phone  * 919-254-8021
Snail  * MZDA/062, IBM Corp., P.O. Box 12195, RTP, NC 27709-2195




Mime
View raw message