Handling of Excel's serial dates

We added another Helper function to convert the Excel Serial Date to a java Date. If you call Cell.getValue() or Cell.getStringValue(), we were getting back somethign like 32506 (the Excel serial date). This could be added to your Helper class.

public static final java.util.Date convertExcelSerialDate(int serialDate) {
Calendar interestDate = Calendar.getInstance();

interestDate.clear();
interestDate.set( 1900, Calendar.JANUARY, 0, 0, 0, 0 );

// Excel adds an extra day for February 29, 1900, which does not actually exist, so offset
if( serialDate > 60 ) serialDate--;

interestDate.add( Calendar.DATE, serialDate );

return interestDate.getTime();
}

Hi,

Thanks first.

It is determined by the number format style of the cell that whether the value type is DATE.

So if you find the value type is DATE but the return value is number ,please post your number format id(See Style.getNumber()) or custom number formart string(See Style.getCustom), we will check it.

And we will add Cell.getDateTimeValue() method to return a date value.

Hi,

Please the the fix in <A href="</A>.</P> <P>We have add Cell.getDateTimeValue() and CellsHelper.converExcelSerialDate() methods.</P>

Very awesome.

FYI: I found a small typo in a function name: Worksheet.getCommnents()

Thanks for the updates.

Hi,

Thanks.

We will fix it quickly.