1

How do I get the difference between the current time GMT and the time on the HMT based on the locale? (Both time and result in seconds).

This code return 0.

    long now = new Date().getTime()/1000;
    long currTime = getCurrentTimeStamp();
    long answer = (now - currTime);
    return answer;
Anirudh Sharma
  • 7,928
  • 13
  • 37
  • 41
Artem
  • 4,421
  • 10
  • 39
  • 83
  • The time is the same, its only the presentation that differs. I guess you are interested in the time zone difference? If so check out http://stackoverflow.com/a/15084967/233048 – mach Nov 12 '14 at 07:46
  • You can write answer and I check it as right – Artem Nov 12 '14 at 07:57

1 Answers1

1

The time is the same, its only the presentation that differs. I guess you are interested in the time zone difference? If so check out Naveen Kumars answer on how to get the timezone offset.

Community
  • 1
  • 1
mach
  • 8,046
  • 3
  • 32
  • 51