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

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

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

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

    1. <tfoot id='pTt2c'></tfoot>
      1. Java將double轉換為日期格式

        Java convert double to date format(Java將double轉換為日期格式)

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

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

                1. <small id='gp4S4'></small><noframes id='gp4S4'>

                2. 本文介紹了Java將double轉換為日期格式的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我在 ios+firebase 中做了一個小應用程序,現在我正在嘗試連接 android.在 ios 中,我將日期保存為雙精度(例如:-242528463.775282),但隨后我嘗試在 java 中檢索相同的雙精度,它給了我另一個日期.

                  I have made a little app in ios+firebase, now I am trying to connect android. In ios I save date as double (for example: -242528463.775282), but then I trying to retrieve same double in java it giving me another date.

                  在 IOS - 01.07.2009在 Java 中 - 29.12.1969

                  in IOS - 01.07.2009 in Java - 29.12.1969

                    double myDouble = date;
                    long myLong = (long) (myDouble);
                    System.out.println(myLong);
                  
                    Date itemDate = new Date(itemLong);
                    String myDateStr = new SimpleDateFormat("dd-MM-yyyy").format(itemDate);             
                    editTextDate.setText(myDateStr);
                  

                  是否可以在不轉換為 long 的情況下將 double 轉換為 date?

                  Is it possible to convert double to date without converting to long?

                  推薦答案

                  由于你的 double 代表你從現在開始日期的秒數,而 Date 構造函數在Java 預計自 01-01-1970 以來的毫秒數,您必須乘以您的數字以獲得毫秒數 (* 1000),然后從 01-01 以來的當前毫秒數中減去該數-1970(System.currentTimeMillis()):

                  Since your double represents the number of seconds of you date from now, and the Date constructor in Java is expecting a number of milliseconds since 01-01-1970, you have to multiply your number to get a number of milliseconds (* 1000) and substract that from the current number of milliseconds since 01-01-1970 (System.currentTimeMillis()):

                  double myDouble = -242528463.775282;
                  long myLong = System.currentTimeMillis() + ((long) (myDouble * 1000));
                  System.out.println(myLong);
                  
                  Date itemDate = new Date(myLong);
                  String myDateStr = new SimpleDateFormat("dd-MM-yyyy").format(itemDate);
                  System.out.println(myDateStr);
                  

                  但是,您存儲日期的方式的問題是,如果您今天和明天調用此代碼,它將不會返回相同的日期,因為當前時間正在改變.您應該使用 timeIntervalSince1970 而不是 timeIntervalSinceNow.

                  But, the problem with the way you store your dates is that if you are calling this code today and tomorrow it will not return the same date, as the current time is changing. You should use timeIntervalSince1970 instead of timeIntervalSinceNow.

                  這篇關于Java將double轉換為日期格式的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

                  quot;Char cannot be dereferencedquot; error(“Char 不能被取消引用錯誤)
                  Java Switch Statement - Is quot;orquot;/quot;andquot; possible?(Java Switch 語句 - 是“或/“和可能的?)
                  Java Replace Character At Specific Position Of String?(Java替換字符串特定位置的字符?)
                  What is the type of a ternary expression with int and char operands?(具有 int 和 char 操作數的三元表達式的類型是什么?)
                  Read a text file and store every single character occurrence(讀取文本文件并存儲出現的每個字符)
                  Why do I need to explicitly cast char primitives on byte and short?(為什么我需要在 byte 和 short 上顯式轉換 char 原語?)
                3. <tfoot id='AHS6L'></tfoot>

                    <bdo id='AHS6L'></bdo><ul id='AHS6L'></ul>

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

                        1. <small id='AHS6L'></small><noframes id='AHS6L'>

                            <tbody id='AHS6L'></tbody>
                          • 主站蜘蛛池模板: 成人一区二区三区 | 色综合天天网 | 九九激情视频 | 亚洲午夜精品视频 | 视频一区中文字幕 | 美女黄18岁以下禁止观看 | 亚洲 欧美 日韩在线 | 黑人巨大精品欧美黑白配亚洲 | 中文字幕亚洲一区二区三区 | 超碰精品在线观看 | 三级黄片毛片 | 中文字幕在线视频精品 | 亚洲综合在线视频 | 天天干天天草 | 日韩一区二区在线免费观看 | 日韩欧美在线观看 | 自拍偷拍亚洲欧美 | 91精品国产一二三 | 欧美一级黄色网 | 久久国产精品视频 | 欧美国产日韩在线观看 | 久久午夜电影 | 精品日韩一区二区 | 日本网站在线看 | 国产日韩精品一区二区三区 | 午夜影院操 | 日韩专区中文字幕 | 国产精品久久久久久吹潮日韩动画 | 亚洲国产成人av好男人在线观看 | 亚洲国产aⅴ成人精品无吗 欧美激情欧美激情在线五月 | 欧美精品日韩 | 一区二区三区四区免费在线观看 | 伊人手机在线视频 | 在线看片网站 | av在线免费看网址 | 在线 丝袜 欧美 日韩 制服 | 网站国产| 国产精品视频免费观看 | 97国产爽爽爽久久久 | 在线成人av| 精品国产久|