HSSFDateUtil.isCellDateFormatted() refers to the Excel Dev's Kit
as the authority for its list of built in date and time formats.
However the excel product seems to have moved on, my copy shows
about 19 formats in its cell formatting dialog box, and does not
have any obvious way to add more formats. 

The result is, isCellDateFormatted() fails for some legitimate 
xcel date/time strings.

I made an xls that used all formats (I may have missed one) on 
the same date/time and then used HSSF to dump out the format 
indices xcel uses, as shown here in rows 3-13 and 15-22.

=========================== START testAnalyseXcelDateFormats
. row[0] ,  cell 0: null
. row[1] , === not numeric ===
. row[2] , === not numeric ===
. row[3] , col 0, built-in format: e  , m/d/yy
. row[4] , col 0, outside XDK spec a5 
. row[5] , col 0, built-in format: 10 , d-mmm
. row[6] , col 0, built-in format: f  , d-mmm-yy
. row[7] , col 0, outside XDK spec a6 
. row[8] , col 0, outside XDK spec a7 
. row[9] , col 0, outside XDK spec a8 
. row[10], col 0, outside XDK spec a9 
. row[11], col 0, built-in format: 16 , m/d/yy h:mm
. row[12], col 0, outside XDK spec aa 
. row[13], col 0, outside XDK spec ab 
. row[14], === not numeric ===
. row[15], col 0, built-in format: 14 , h:mm
. row[16], col 0, built-in format: 12 , h:mm AM/PM
. row[17], col 0, built-in format: 15 , h:mm:ss
. row[18], col 0, built-in format: 13 , h:mm:ss AM/PM
. row[19], col 0, built-in format: 2f , mm:ss.0
. row[20], col 0, built-in format: 2e , [h]:mm:ss
. row[21], col 0, outside XDK spec a9 
. row[22], col 0, built-in format: 16 , m/d/yy h:mm
=========================== EXIT testAnalyseXcelDateFormats

Since xcel has a fixed number of time/date formats, all
uniquely id'd by dataformat indexes, why not just extend the list
in HSSFDateUtil.isCellDateFormatted() to recognize them ?

Bill.  

Reply via email to