poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From George Papastamatopoulos <George.Papastamatopou...@lawlex.com.au>
Subject RE: Dates, Dates and more dates.
Date Wed, 04 Jun 2003 22:58:18 GMT
Hey thanks for the reply.

Actually was able to narrow the problem down further.  

Turns out the dates I was using in my application were all set to the last
millisecond of the day eg 23:59:59:999.  Looks like excel was rounding this
value up to the nearest second, thus pushing the value displayed in the cell
to the next day.  I think (although my understanding of excel is limited)
this would be due to the fact that excel understands only hours, minutes and


-----Original Message-----
From: Danny Mui [mailto:danny@muibros.com]
Sent: Thursday, 5 June 2003 12:36 AM
To: POI Users List
Subject: Re: Dates, Dates and more dates.

Yeah, I know the dates are a little off at the moment, and is related 
to  http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19792.  Currently 
working on other parts of HSSF but I will try to address it within the 
"soon" timeframe.

IF you want to give it a stab, you can look at the HSSFDateUtil and 
determine where it strays.  Basically excel stores date in double 
format, so make sure the DateUtil generates the correct double values 
for known dates.


George Papastamatopoulos wrote:

>>Im experiencing some really wierd and frustrating behaviour when dealing
>>with dates.
>>Whenever I generate a spreadsheet with dates and then open up the
>>spreadsheet, the value displayed in the cell is always one day ahead of
>>the value displayed in the formula bar (the formula bar always displays
>>the correct date).  What's wierd is that when I click into the cell edit,
>>and then hit enter, the correct date is then displayed in the cell.
>>I've searched the archives and have seen similar postings relating to 'how
>>to read dates from excel', but havnt come across any solutions.
>>I've tried all sorts of combinations and permutations of cell styles,
>>formats etc, but have been unable to solve the problem.
>>If anyone has suggestions, they would be much appreciated.  I've pasted in
>>the latest code snippet below.
>>HSSFCellStyle cellStyle = wb.createCellStyle();
>>HSSFDataFormat format = wb.createDataFormat();
>>Date myDate = myObject.getTheDate();
>> * Also tried the following and a bunch of other things
>> */
>>//  cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC);
>>//  cell.setCellValue(myDate);
>>George Papastamatopoulos
>>Lawlex Compliance Solutions
>>phone: +61 3 9278 1182
>>email: georgep@lawlex.com.au
>To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: poi-user-help@jakarta.apache.org

To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-user-help@jakarta.apache.org

View raw message