Return-Path: Mailing-List: contact poi-user-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list poi-user@jakarta.apache.org Received: (qmail 14689 invoked from network); 12 Mar 2003 16:34:30 -0000 Received: from e2.ny.us.ibm.com (32.97.182.102) by daedalus.apache.org with SMTP; 12 Mar 2003 16:34:30 -0000 Received: from northrelay04.pok.ibm.com (northrelay04.pok.ibm.com [9.56.224.206]) by e2.ny.us.ibm.com (8.12.8/8.12.2) with ESMTP id h2CGYPE0086398 for ; Wed, 12 Mar 2003 11:34:25 -0500 Received: from d01ml077.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by northrelay04.pok.ibm.com (8.12.8/NCO/VER6.5) with ESMTP id h2CGYLlg114850 for ; Wed, 12 Mar 2003 11:34:22 -0500 Subject: Recognizing Dates To: poi-user@jakarta.apache.org X-Mailer: Lotus Notes Release 6.0 September 26, 2002 Message-ID: From: "John Lloyd" Date: Wed, 12 Mar 2003 11:35:50 -0500 X-MIMETrack: Serialize by Router on D01ML077/01/M/IBM(Release 5.0.11 +SPRs MIAS5EXFG4, MIAS5AUFPV and DHAG4Y6R7W, MATTEST |November 8th, 2002) at 03/12/2003 11:34:23 AM MIME-Version: 1.0 Content-type: text/plain; charset=us-ascii X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N 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 " 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