Android的如何获得设备的时间并不时区时间 [英] Android how to get device's time not timezone time

查看:220
本文介绍了Android的如何获得设备的时间并不时区时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的情况是:用户设置时区以 UTC + 5 ,例如,然后关闭时间和时区同步。当他去 UTC + 4 时区,他刚刚成立的时候回一小时,不接触时区。

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.

所以 Calendar.getInstance() System.currentTimeMillis的()返回时间 UTC + 5 ,例如,14:00,但该设备显示13:00。

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

我怎样才能获得设备的时间和当前时区时间之间的设备时(13:00)或区别?

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

推荐答案

所有我能找到,这里保存在这个<一个href=\"https://pristalovpavel.word$p$pss.com/2015/08/13/how-to-get-the-real-device-time-with-wrong-time-zone/\"相对=nofollow>帖子。

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).

这也适用于取消夏令时:一些设备还认为,在莫斯科的夏天时区 GMT + 4 ,另一部分人都知道它的 GMT + 3 。你不能在本地同步本地这些设备一般。

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.

这篇关于Android的如何获得设备的时间并不时区时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆