久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

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

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

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

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

        • <bdo id='ZXTDf'></bdo><ul id='ZXTDf'></ul>

        Java DateFormat parse() 不尊重時區

        Java DateFormat parse() doesn#39;t respect the timezone(Java DateFormat parse() 不尊重時區)
            <tbody id='qzmXt'></tbody>

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

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

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

                  本文介紹了Java DateFormat parse() 不尊重時區的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("America/New_York"));
                  DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z");
                  df.setTimeZone(TimeZone.getTimeZone("America/New_York"));
                  
                  try {
                      System.out.println(df.format(cal.getTime()));
                      System.out.println(df.parse(df.format(cal.getTime())));
                  } catch (ParseException e) {
                      e.printStackTrace();
                  }
                  

                  結果如下:

                  2011-09-24 14:10:51 -0400

                  2011-09-24 14:10:51 -0400

                  2011 年 9 月 24 日星期六 20:10:51 CEST

                  Sat Sep 24 20:10:51 CEST 2011

                  為什么當我解析從 format() 獲得的日期時,它不遵守時區?

                  Why when I parse a date I get from format() it doesn't respect the timezone?

                  推薦答案

                  你正在打印調用 Date.toString()總是使用默認時區.基本上,您不應該將 Date.toString() 用于除調試以外的任何事情.

                  You're printing the result of calling Date.toString(), which always uses the default time zone. Basically, you shouldn't use Date.toString() for anything other than debugging.

                  不要忘記 Date 沒有時區 - 它代表時間的瞬間,以 Unix 紀元以來的毫秒數(1 月的午夜1970 UTC).

                  Don't forget that a Date doesn't have a time zone - it represents an instant in time, measured as milliseconds since the Unix epoch (midnight on January 1st 1970 UTC).

                  如果您再次使用格式化程序格式化日期,應該會得出與以前相同的答案.

                  If you format the date using your formatter again, that should come up with the same answer as before.

                  順便說一句,我建議使用 Joda Time 而不是 Date/Calendar 如果你在 Java 中做大量的日期/時間工作;這是一個非常更好的 API.

                  As an aside, I would recommend the use of Joda Time instead of Date/Calendar if you're doing any significant amount of date/time work in Java; it's a much nicer API.

                  這篇關于Java DateFormat parse() 不尊重時區的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How can I detect integer overflow on 32 bits int?(如何檢測 32 位 int 上的整數溢出?)
                  Local variables before return statements, does it matter?(return 語句之前的局部變量,這有關系嗎?)
                  How to convert Integer to int?(如何將整數轉換為整數?)
                  How do I create an int array with randomly shuffled numbers in a given range(如何在給定范圍內創建一個隨機打亂數字的 int 數組)
                  Inconsistent behavior on java#39;s ==(java的行為不一致==)
                  Why is Java able to store 0xff000000 as an int?(為什么 Java 能夠將 0xff000000 存儲為 int?)

                    • <bdo id='pbveo'></bdo><ul id='pbveo'></ul>
                        <i id='pbveo'><tr id='pbveo'><dt id='pbveo'><q id='pbveo'><span id='pbveo'><b id='pbveo'><form id='pbveo'><ins id='pbveo'></ins><ul id='pbveo'></ul><sub id='pbveo'></sub></form><legend id='pbveo'></legend><bdo id='pbveo'><pre id='pbveo'><center id='pbveo'></center></pre></bdo></b><th id='pbveo'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='pbveo'><tfoot id='pbveo'></tfoot><dl id='pbveo'><fieldset id='pbveo'></fieldset></dl></div>
                        • <small id='pbveo'></small><noframes id='pbveo'>

                              <tbody id='pbveo'></tbody>
                          • <tfoot id='pbveo'></tfoot>

                            <legend id='pbveo'><style id='pbveo'><dir id='pbveo'><q id='pbveo'></q></dir></style></legend>
                            主站蜘蛛池模板: 国产成人a亚洲精品 | 成人精品系列 | 久久欧美高清二区三区 | 在线一区二区三区 | 激情一区二区三区 | 欧美 日韩 国产 成人 在线 91 | 99riav国产一区二区三区 | 天天干人人 | 日韩精品一区二区三区在线播放 | 免费一区| 国产真实乱全部视频 | 国产欧美日韩一区二区三区在线 | 九色 在线| 欧美啪啪 | 国产精品视频一区二区三区不卡 | 婷婷免费视频 | 日产久久 | 日韩欧美在线观看 | a级大片免费观看 | 久久不射电影网 | 欧美日日 | 免费久久精品 | 99视频在线免费观看 | 亚洲精品久久久 | 久久久99精品免费观看 | jav成人av免费播放 | 国产精品久久久久久久久久久久冷 | 久久久亚洲一区 | 99热在线观看精品 | 国产成人精品一区二区 | 国产成人99久久亚洲综合精品 | 激情小视频 | 久久久久久电影 | 激情久久网 | 亚洲网在线 | 狠狠操天天干 | 在线观看亚洲 | 日本三级电影在线看 | 久久成人精品视频 | 91免费观看在线 | 成人精品视频在线观看 |