JXL and Date Time Zones

C

Chad

Hi,

I'm using the JXL class (Java Excel API) to get a date from an excel
file. That date is in EST in the Excel file, but when I grab it using
jxl it changes it to my local zone PST. Is there any way to grab it AS
the format that is in the xls file (est in this case)? I know I can
convert it after it's a date object but I don't want to do that because
it'll interfere with the rules to which this program is supposed to
abide by.

here is the code I use:

Date d = ((DateCell)sheet.getCell(dateTimeCol,row)).getDate();


d.toString() returns:

Thu Oct 27 18:30:00 PDT 2005

Any ideas appreciated,
Thanks!

Chad Arimura
 
P

P.Hill

Chad said:
Hi,
That date is in EST in the Excel file, but when I grab it using
jxl it changes it to my local zone PST. Is there any way to grab it AS
the format that is in the xls file (est in this case)? I know I can
convert it after it's a date object but I don't want to do that because
it'll interfere with the rules to which this program is supposed to
abide by.

Okay, so why do you think this value is "in EST"?
Firstly, it is not in EST it is in what we might call
Eastern Time which includes a EST and EDT period.

Okay, now that I got that off my chest; let me add
that Dates are not in any TZ, they just print that way.
They are a binary number. Do they print as what the wall
time in the "Pacific" zone would be or what the wall
time in Eastern would Be? Case 1: the sheet
says 5:00 PM your result says 2:00 PM. Alternatively,
case 2: the sheet says 5:00 PM and your date object prints
as 5:00 PM.

Assuming you are in Pacific time, case one is explained
by the API knowing the TZ of the data, so it knew how to
convert 5:00 PM EST to a binary number which is displaying
by default in your local machine time as 2 PM.

The second case is explained by the API finding 5:00 PM, not knowing
the TZ, so it assumed your local zone (Pacific) and making a local 5PM PST.

So which is it?

-Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top