【问题标题】:How to convert the UTC time into the device time in android when using GPS?使用GPS时如何将UTC时间转换为android中的设备时间?
【发布时间】:2012-01-04 11:39:34
【问题描述】:

大家好,请任何人都可以告诉如何将UTC时间转换为android设备当前时间....

实际上,当我们在手机中使用 GPS 服务时,我会显示纬度、经度、高度和时间

这里的时间以 UTC 毫秒的格式出现,我想将该时间转换为设备当前时间

【问题讨论】:

    标签: android gps utc


    【解决方案1】:

    试试这个代码

    String dat = new SimpleDateFormat("ddMMyy").format(location.getTime())
    

    【讨论】:

      【解决方案2】:
      Date d = new Date(System.currentTimeMillis());
      d.toLocaleString(); //to phone's locale
      d.toGMTString(); //in GMT
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2013-01-28
        • 1970-01-01
        • 1970-01-01
        • 2020-12-07
        • 1970-01-01
        • 2013-03-23
        • 2021-07-22
        • 1970-01-01
        相关资源
        最近更新 更多