Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2005

Tip: Looking for answers? Try searching our database.

JXL and Date Time Zones

Thread view: 
Chad - 11 Nov 2005 19:17 GMT
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.Hill - 12 Nov 2005 08:15 GMT
> Hi,
> That date is in EST in the Excel file, but when I grab it using
[quoted text clipped - 3 lines]
> 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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.