• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to get present time in GMT  RSS feed

 
Kishore Dandu
Ranch Hand
Posts: 1934
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any shed of light on this is appreciated.
 
Ian Darwin
author
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No problem: use a DateFormat with setTimeZone(). DateFormat is discussed in Chapter 6 of the Java Cookbook.

I just ran that, at 19:52 (7:52 PM) Eastern time, and it prints the current time in both zones
(Eastern time is currently GMT-4):

Of course 11:52PM is 23:52, and 23 - 19 = 4 hours.

Hope this helps
Ian
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!