File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Date problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Date problem" Watch "Date problem" New topic

Date problem

Pinal N Patel
Ranch Hand

Joined: Sep 05, 2003
Posts: 57
Hello everyone,

I am building a web page with functionality for user to upload (using the browse function) their pictures (jpeg format) into the application. Once the picture is uploaded, I display the picture in a thumbnail fashion along with date/time of when the picture was taken. I am reading the Jpeg's Exif data using Open source tool called "Metadata Extractor" to retrieve picture taken time for display purpose.

The problem is that when I read the picture taken time, which is of Date object, I can not read the timezone information from the date object. Rather, I can not even modify it; the date object gets assigned the default timezone on where the server is located.

For example: If I take a picture at 2PM in EST timezone and if the server is in PST timezone, then when I upload the jpeg, the date object is misrepresented with 2PM of PST (PST is added to the date obects as a default server timezone) when the correct time is 2PM of EST. In this case, the date/time data is incorrect.

Please kindly provide any insight to resolve this issue. I appreciate any help I can get.

Thanks in advance as always!!

Rob Spoor

Joined: Oct 27, 2005
Posts: 20269

Date objects do not have a notion of timezone. You should check out Calendar and GregorianCalendar instead.

How To Ask Questions How To Answer Questions
I agree. Here's the link:
subject: Date problem
It's not a secret anymore!