Loading...

poi-user@jakarta.apache.org

[Prev] Thread [Next]  |  [Prev] Date [Next]

AW: How to read data as it appears in the excel sheet......... KHZ (SAW) Sat Jul 16 11:11:28 2005

Hi.

That's just a date. From that it's desired to have the string
representation like mentioned at the beginning. So as mentioned
initially to this the formatting has to be applied with normal Java
means.

Regards,        Karl-Heinz.


-----Urspr√ľngliche Nachricht-----
Von: Amol Deshmukh [mailto:[EMAIL PROTECTED] 
Gesendet: Freitag, 15. Juli 2005 18:50
An: 'POI Users List'
Betreff: RE: How to read data as it appears in the excel sheet.........

So to convert this to a java time do the following:
> - adjust for the different start day Jan 1, 1970 is excel date 25,569
> - multiply by the number of milliseconds in a day 8,6400,000
> - convert to a Date using java.util.date.Date(long date)
> - use the Calendar class to adjust timezone 
> - use java.text.SimpleDateFormat to convert it to text.
> 
> /peter
> 

...which is almost what HSSFDateUtil.getJavaDate(Date) does :)
...and you dont even have to call HSSFDateUtil.getJavaDate(Date)
if you use HSSFCell.getDateCellValue() since thats what it
uses internally.

~ amol

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/