久久久久久久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() 不尊重時(shí)區(qū)

        Java DateFormat parse() doesn#39;t respect the timezone(Java DateFormat parse() 不尊重時(shí)區(qū))
            <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() 不尊重時(shí)區(qū)的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

                  問(wèn)題描述

                  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();
                  }
                  

                  結(jié)果如下:

                  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

                  為什么當(dāng)我解析從 format() 獲得的日期時(shí),它不遵守時(shí)區(qū)?

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

                  推薦答案

                  你正在打印調(diào)用 Date.toString(),總是使用默認(rèn)時(shí)區(qū).基本上,您不應(yīng)該將 Date.toString() 用于除調(diào)試以外的任何事情.

                  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 沒(méi)有時(shí)區(qū) - 它代表時(shí)間的瞬間,以 Unix 紀(jì)元以來(lái)的毫秒數(shù)(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).

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

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

                  順便說(shuō)一句,我建議使用 Joda Time 而不是 Date/Calendar 如果你在 Java 中做大量的日期/時(shí)間工作;這是一個(gè)非常更好的 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.

                  這篇關(guān)于Java DateFormat parse() 不尊重時(shí)區(qū)的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

                  How can I detect integer overflow on 32 bits int?(如何檢測(cè) 32 位 int 上的整數(shù)溢出?)
                  Local variables before return statements, does it matter?(return 語(yǔ)句之前的局部變量,這有關(guān)系嗎?)
                  How to convert Integer to int?(如何將整數(shù)轉(zhuǎn)換為整數(shù)?)
                  How do I create an int array with randomly shuffled numbers in a given range(如何在給定范圍內(nèi)創(chuàng)建一個(gè)隨機(jī)打亂數(shù)字的 int 數(shù)組)
                  Inconsistent behavior on java#39;s ==(java的行為不一致==)
                  Why is Java able to store 0xff000000 as an int?(為什么 Java 能夠?qū)?0xff000000 存儲(chǔ)為 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>
                            主站蜘蛛池模板: 四虎最新视频 | 91精品国产91久久久久游泳池 | 亚洲一区中文字幕 | 在线免费观看毛片 | 成人影音 | 国产精品一区二区三区久久久 | 国产精品久久久久久久久免费软件 | 国产精品视频综合 | 在线一区二区三区 | 成年人在线观看 | 久久久久久久久99精品 | 精品一区二区三区四区五区 | 日本精品久久久久 | 在线观看亚洲精品 | 蜜桃视频在线观看免费视频网站www | 欧美日韩在线一区二区 | 在线午夜| 欧美全黄 | 欧美日韩国产在线 | 日韩中文一区二区三区 | 国产一区二区在线免费视频 | 国产清纯白嫩初高生视频在线观看 | 日韩在线不卡 | 欧美男人天堂 | 中文字幕一区二区三区不卡在线 | 中文字幕一区二区视频 | 在线观看中文字幕视频 | 一区二区蜜桃 | 亚洲综合成人网 | 一区在线观看 | 日韩a视频 | 欧美激情综合色综合啪啪五月 | 欧洲免费视频 | 国产午夜精品一区二区三区四区 | 精品在线视频播放 | 国产精品国产a级 | 国产精品1区 | 国产欧美一级二级三级在线视频 | 99亚洲精品 | 国内自拍偷拍视频 | 伊久在线|