• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

How do I convert a GMT date to a local date

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are like 1,000 posts on this subject, but I've been reading various topics off and on all day and haven't figured out how to solve this problem I'm having.

What I've got is a date being returned from an SDK that is actually in GMT, but the timezone says EDT. When I output the date it is showing 3 hours ahead which is the GMT time.

Given a Date object, that is a GMT date/time, how do I convert this thing to a local timezone.

Many thanks for any help,
Dale
 
Rancher
Posts: 43011
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

The problem with the Date class is that it is totally ignorant of timezones. If timezones matter, then you should use the Calendar class and tell it specifically which timezone to use.
 
pie. tiny ad:
professionally read, modify and write PDF files from Java
https://products.aspose.com/pdf/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!