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

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

      <bdo id='1aJyY'></bdo><ul id='1aJyY'></ul>
    1. <small id='1aJyY'></small><noframes id='1aJyY'>

    2. Android将中部时间转换为当地时间

      时间:2023-07-25
          • <bdo id='G0ut9'></bdo><ul id='G0ut9'></ul>

              <legend id='G0ut9'><style id='G0ut9'><dir id='G0ut9'><q id='G0ut9'></q></dir></style></legend>

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

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

              • <tfoot id='G0ut9'></tfoot>
                本文介绍了Android将中部时间转换为当地时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我有一个 MySql 数据库,它为我插入的每条记录存储一个时间戳.我将该时间戳作为字符串提取到我的 Android 应用程序中.我的数据库位于具有 CST 时区的服务器上.我想将该 CST 时间戳转换为 Android 设备的本地时间.

                I have a MySql database that stores a timestamp for each record I insert. I pull that timestamp into my Android application as a string. My database is located on a server that has a TimeZone of CST. I want to convert that CST timestamp to the Android device's local time.

                有人可以帮忙吗?

                推荐答案

                你不能简单地用 simpleDateFormat?然后你只需定义传入日期的结构(df)并将其转换为你想要的形式(df):

                can't you simply convert the date with simpleDateFormat? then you just define the structure of your incoming date like that (df) and transform it to the form you want (df):

                private static DateFormat df = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z");
                private static DateFormat df2 = new SimpleDateFormat("dd/MM/yyyy 'at' HH:mm");
                
                public void setyourDate(String yourDate) {
                Date date2;
                yourDate = getyourDate() + "" + yourDate;
                try {
                date2 = df.parse(yourDate);
                yourDate = df2.format(date2);
                
                } catch (ParseException e) {
                }
                this.yourDate = yourDate;
                }
                

                有意义吗?

                这篇关于Android将中部时间转换为当地时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:休眠强制时间戳以保持/加载为 UTC 下一篇:将 XMLGregorianCalendar 转换为 java.sql.Timestamp

                相关文章

                最新文章

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

                    <legend id='vapdN'><style id='vapdN'><dir id='vapdN'><q id='vapdN'></q></dir></style></legend>

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