【问题标题】:Get UTC time for an android app获取 Android 应用程序的 UTC 时间
【发布时间】:2015-09-18 09:04:15
【问题描述】:

我目前正在开发 android 应用程序,我想在其中从 Internet 获取 UTC 时间并确定当前本地时间。

我是android开发新手,谁能帮帮我?

【问题讨论】:

  • get UTC time from the internet 是什么意思?从你的服务器?
  • 不是来自我的服务器,一些常见的地方/服务器显示了确切的时间(UTC),我可以根据不同的位置将其转换为本地时间
  • 我收到此错误。无法执行 HTTP 请求:写入错误:ssl=0xb79c18d8:系统调用期间 I/O 错误,对等方重置连接

标签: android utc


【解决方案1】:
SimpleDateFormat dateFormatGmt = new SimpleDateFormat("yyyy-MMM-dd HH:mm:ss");
dateFormatGmt.setTimeZone(TimeZone.getTimeZone("GMT"));

你在同一个java中使用代码

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-01-24
    • 2013-01-28
    • 2012-02-28
    • 1970-01-01
    • 2011-02-18
    • 2019-08-25
    • 2016-04-01
    • 1970-01-01
    相关资源
    最近更新 更多