Thanks for all your replies.

>> If you are using java.util.Calendar, then it should have started at 0.  So
>> Jan 0, 2003 in Calendar would be Jan 1 2003 in english.
I thought about that, but quoting the Calendar javadocs:
    "The first day of the month has value 1"

Plus, when I do a myDate.toString(), I get the correct date...it's just the
long number that myCell.setCellValue(myDate) comes up with is interpreted by
Excel with an offset.

Regarding 1900 vs. 1904...As I understand it, the java.util.Date class
measures time uniformly across platforms (number of milliseconds after the
epoch - Jan 1 1970 00:00:00.000 GMT) - so I don't understand how that can be
an issue in the Java realm.

Yes, I am using POI 2.0RC1.  Just to reiterate the issue I'm having:
> input Date's:
>
> Sat Nov 01 00:00:00 CST 2003
> Sat Nov 15 00:00:00 CST 2003
> Sun Nov 16 00:00:00 CST 2003
> 
> And here is what shows up in Excel (in both the cell and formula bar) after
> doing a myCell.setCellValue(myDate):
> 
> 11/2/07
> 11/16/07
> 11/17/07


Is anyone else having a similar issue?

Thank you,

-Sasha Borodin

>> -----Original Message-----
>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
>> Sent: Tuesday, November 25, 2003 7:28 PM
>> To: POI Users List
>> Subject: Re: AW: setCellValue(Date) is displayed ahead by 1 day and 4
>> years
>> 
>> 
>> The 1 day issue is probably combination of a rounding error plus timezone
>> plus
>> midnight (00:00) time... could be in POI, could be in your code.. needs
>> investigation....
>> 
>> The four years issue is the difference between files created on a Mac vs
>> files
>> created on a PC. While one uses a 1904 date baseline, the other uses 1900
>> (or
>> vice versa.... since its near midnight in my timezone, i shall not tax my
>> brain
>> to remember which is which) ...
>> 
>> There is low level record (the "1904" record) that tells you which format
>> the
>> data is stored in the file. I dont know if/how POI handles this at a higher
>> level... probably getDateValue should account for this.....
>> 
>> Quoting Sasha Borodin <[EMAIL PROTECTED]>:
>> 
>>> CST is Central Standard Time (a U.S. Time zone) - but that's just what
>>> Date.toString() outputs in my locale...it's still just a java.util.Date
>>> that's being passed to Cell.setCellValue().
>>> 
>>> Thanks for your reply.
>>> 
>>> -Sasha
>>> 
>>> On 11/25/03 10:36 AM, "Mehner, Bj�rn" <[EMAIL PROTECTED]> wrote:
>>> 
>>>>> HSSFRow header = sheet.getRow((short) 0);
>>>>> header.createCell((short) 0).setCellValue(aDate);
>>>>> 
>>>>> Of course I also create a date style, and set the cell style to that.
>>>>> 
>>>>> So for example, this is some debugging (toString) for 3 dates:
>>>>> 
>>>>> Sat Nov 01 00:00:00 CST 2003
>>>>> Sat Nov 15 00:00:00 CST 2003
>>>>> Sun Nov 16 00:00:00 CST 2003
>>>> 
>>>> What on earth is CST? Maybe you are using a timezone Excel cannot deal
>>>> with?
>>>> 
>>>> ciao Bodo
>>>> 
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>> 
>>> 
>> 
>> 
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> 
>> 
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to