This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Date problem

 
Pinal N Patel
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!!

Regards
 
Rob Spoor
Sheriff
Pie
Posts: 20546
57
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Date objects do not have a notion of timezone. You should check out Calendar and GregorianCalendar instead.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic