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,968
  • 13
  • 40
  • 42
Artem
  • 4,569
  • 12
  • 44
  • 86
  • 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,315
  • 3
  • 33
  • 51