anil
anil

Reputation: 2113

Android how to get device's time not timezone time

My case is: user set timezone to UTC+5, for example, and then turn off time and timezone sync. When he goes to UTC+4 timezone, he just set the time back to an hour, without touching timezone.

So the Calendar.getInstance() and System.currentTimeMillis() return the time for UTC+5, for example, 14:00, but the device shows 13:00.

How can I get the device time(13:00) or difference between device time and current timezone time?

Upvotes: 1

Views: 773

Answers (1)

anil
anil

Reputation: 2113

All that I could find, kept here in this post.

Summary: it is impossible to obtain the necessary time difference with no additional queries to the server and / or receiving your own coordinates (which may not always be available).

This also applies to canceled daylight time: some devices still believes that in the summer time zone of Moscow is GMT+4, other part knows that it's GMT+3. And you can not locally sync these devices locally, in general.

Upvotes: 1

Related Questions