Page 1 of 1

How to retrieve Date from xslx file

PostPosted: Wed Jul 22, 2015 9:18 am
by Oleksandr
Hi All,

I'm trying to parse XSLS file where the B15 cell is DATE and the value is 2015/03/23.

The /xl/worksheets/sheet1.xml file represents it as:
Code: Select all
                <ns2:row r="15" spans="1:5">
                    <ns2:c r="B15" s="31">
                        <ns2:v>40624</ns2:v>
                    </ns2:c>
                </ns2:row>


How to convert "40624" value to "2015/03/23"?

Thank you in advance
Alex

Re: How to retrieve Date from xslx file

PostPosted: Wed Jul 22, 2015 7:15 pm
by Oleksandr
I found an explanation of it http://webapp.docx4java.org/OnlineDemo/ecma376/SpreadsheetML/file_5.html

Is there a Util like: DocxDateUtil.convertToDate(40624)?

Re: How to retrieve Date from xslx file

PostPosted: Fri Jul 24, 2015 8:49 am
by fachhoch
Use
Code: Select all
HSSFDateUtil.getJavaDate(Double.valueOf(dateCell.getV()))

Re: How to retrieve Date from xslx file

PostPosted: Fri Jul 24, 2015 9:56 pm
by Oleksandr
Thank you so much.

Re: How to retrieve Date from xslx file

PostPosted: Thu Jul 30, 2015 1:52 am
by Oleksandr
How to distinguish Date and Number?
Both data types are represented equally.

Thank you.