• <legend id='vjRbe'><style id='vjRbe'><dir id='vjRbe'><q id='vjRbe'></q></dir></style></legend>

    1. <i id='vjRbe'><tr id='vjRbe'><dt id='vjRbe'><q id='vjRbe'><span id='vjRbe'><b id='vjRbe'><form id='vjRbe'><ins id='vjRbe'></ins><ul id='vjRbe'></ul><sub id='vjRbe'></sub></form><legend id='vjRbe'></legend><bdo id='vjRbe'><pre id='vjRbe'><center id='vjRbe'></center></pre></bdo></b><th id='vjRbe'></th></span></q></dt></tr></i><div id='vjRbe'><tfoot id='vjRbe'></tfoot><dl id='vjRbe'><fieldset id='vjRbe'></fieldset></dl></div>
        • <bdo id='vjRbe'></bdo><ul id='vjRbe'></ul>

        <small id='vjRbe'></small><noframes id='vjRbe'>

      1. <tfoot id='vjRbe'></tfoot>

        如何从 Android 设备获取 GMT(如 GMT+7:00)的时区偏移量?

        时间:2023-05-19

              <tbody id='7PDN9'></tbody>
            <legend id='7PDN9'><style id='7PDN9'><dir id='7PDN9'><q id='7PDN9'></q></dir></style></legend>

                  <bdo id='7PDN9'></bdo><ul id='7PDN9'></ul>
                  <i id='7PDN9'><tr id='7PDN9'><dt id='7PDN9'><q id='7PDN9'><span id='7PDN9'><b id='7PDN9'><form id='7PDN9'><ins id='7PDN9'></ins><ul id='7PDN9'></ul><sub id='7PDN9'></sub></form><legend id='7PDN9'></legend><bdo id='7PDN9'><pre id='7PDN9'><center id='7PDN9'></center></pre></bdo></b><th id='7PDN9'></th></span></q></dt></tr></i><div id='7PDN9'><tfoot id='7PDN9'></tfoot><dl id='7PDN9'><fieldset id='7PDN9'></fieldset></dl></div>
                • <tfoot id='7PDN9'></tfoot>

                  <small id='7PDN9'></small><noframes id='7PDN9'>

                • 本文介绍了如何从 Android 设备获取 GMT(如 GMT+7:00)的时区偏移量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我正在使用此代码获取 android 设备的 timezone

                  I am getting the timezone of a android device using this code

                  TimeZone tz = TimeZone.getDefault();
                  String current_Time_Zone = (TimeZone.getTimeZone(tz.getID()).getDisplayName(
                                  false, TimeZone.SHORT))
                  

                  但它总是像IST"一样返回timezone,但我想像GMT那样在GMT中获取时区+7:00.

                  But it always return me the timezone like "IST" but i want to get the timezone in GMT like this GMT+7:00.

                  推荐答案

                  此代码返回我的 GMT 偏移量.

                  This code return me GMT offset.

                  Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT"),
                                  Locale.getDefault());
                  Date currentLocalTime = calendar.getTime();
                  DateFormat date = new SimpleDateFormat("Z");
                  String localTime = date.format(currentLocalTime);
                  

                  它像这样返回时区偏移量:+0530

                  It returns the time zone offset like this: +0530

                  如果我们在下面使用 SimpleDateFormat

                  If we use SimpleDateFormat below

                  DateFormat date = new SimpleDateFormat("z",Locale.getDefault());
                  String localTime = date.format(currentLocalTime);
                  

                  它像这样返回时区偏移量:GMT+05:30

                  It returns the time zone offset like this: GMT+05:30

                  这篇关于如何从 Android 设备获取 GMT(如 GMT+7:00)的时区偏移量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:将 UTC 日期转换为其他时区 下一篇:将 UTC 日期格式转换为本地 nsdate

                  相关文章

                  <i id='vNNIf'><tr id='vNNIf'><dt id='vNNIf'><q id='vNNIf'><span id='vNNIf'><b id='vNNIf'><form id='vNNIf'><ins id='vNNIf'></ins><ul id='vNNIf'></ul><sub id='vNNIf'></sub></form><legend id='vNNIf'></legend><bdo id='vNNIf'><pre id='vNNIf'><center id='vNNIf'></center></pre></bdo></b><th id='vNNIf'></th></span></q></dt></tr></i><div id='vNNIf'><tfoot id='vNNIf'></tfoot><dl id='vNNIf'><fieldset id='vNNIf'></fieldset></dl></div>
                  <tfoot id='vNNIf'></tfoot>

                    <small id='vNNIf'></small><noframes id='vNNIf'>

                    <legend id='vNNIf'><style id='vNNIf'><dir id='vNNIf'><q id='vNNIf'></q></dir></style></legend>
                      <bdo id='vNNIf'></bdo><ul id='vNNIf'></ul>