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

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

      <tfoot id='o81zc'></tfoot>

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

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

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

        如何將 java.sql.Timestamp(yyyy-MM-dd HH:mm:ss.S) 格式化為

        How to format a java.sql.Timestamp(yyyy-MM-dd HH:mm:ss.S) to a date(yyyy-MM-dd HH:mm:ss)(如何將 java.sql.Timestamp(yyyy-MM-dd HH:mm:ss.S) 格式化為日期(yyyy-MM-dd HH:mm:ss))
          <tbody id='G4oVt'></tbody>
          <i id='G4oVt'><tr id='G4oVt'><dt id='G4oVt'><q id='G4oVt'><span id='G4oVt'><b id='G4oVt'><form id='G4oVt'><ins id='G4oVt'></ins><ul id='G4oVt'></ul><sub id='G4oVt'></sub></form><legend id='G4oVt'></legend><bdo id='G4oVt'><pre id='G4oVt'><center id='G4oVt'></center></pre></bdo></b><th id='G4oVt'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='G4oVt'><tfoot id='G4oVt'></tfoot><dl id='G4oVt'><fieldset id='G4oVt'></fieldset></dl></div>
          <tfoot id='G4oVt'></tfoot>

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

                • <bdo id='G4oVt'></bdo><ul id='G4oVt'></ul>
                • <small id='G4oVt'></small><noframes id='G4oVt'>

                  本文介紹了如何將 java.sql.Timestamp(yyyy-MM-dd HH:mm:ss.S) 格式化為日期(yyyy-MM-dd HH:mm:ss)的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  嗯,我有一個使用 Date 的詳細信息,因為我從我的數據庫和變量fecha"(日期)中獲取了一個我正在獲取的同一對象的對象java.sql.Timestamp,所以格式是毫秒,但我不希望毫秒出現.所以我需要將我從數據庫接收到的日期格式化為沒有毫秒的新日期.

                  Well, I'm having a detail using a Date, because I'm getting an Object from my DataBase and in the variable "fecha" (date) from that same object I'm getting a java.sql.Timestamp, so the formatt is with miliseconds, but i don't want the miliseconds to appear. So i need to formatt the date that I'm receiving from my DB to a new date that doesn't have miliseconds.

                  這是 Factura 的對象:

                  This is the object Factura:

                  public class Factura  implements java.io.Serializable {
                  
                   private FacturaId id;
                   ...
                   private boolean activo;
                   private Date fecha;
                  }
                  

                  在映射到數據庫的 xml 中,我有這個變量fecha"的代碼:

                  In the xml that is mapped to the DB I have this code for that variable "fecha":

                  <property name="fecha" type="timestamp">
                    <column length="19" name="fecha" not-null="true"/>
                  </property>
                  

                  在數據庫中該列是 fecha DATETIME.

                  當我從我的數據庫中獲得一個對象 Factura 時,我得到了這種日期 2013-10-10 10:49:29.0 但我希望它沒有.0(毫秒).

                  And when I get an object Factura from my DB I'm getting this kind of date 2013-10-10 10:49:29.0 but I want it without the .0 (miliseconds).

                  我試過這個(facturaFactura 對象):

                  I've tried this (factura is the Factura object):

                  try {
                     SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                     Date fechaNueva = null;
                     String fechaStr = factura.getFecha().toString();
                     int tama?o = fechaStr.length()-2;
                     fechaStr = fechaStr.substring(0, tama?o); //I get a string without the miliseconds
                     fechaNueva = format.parse(fechaStr);
                  } catch(ParseException ex) {
                     ...
                  }
                  

                  但是 fechaNueva 給了我 Thu Oct 10 10:49:29 CDT 2013 而我只想要 2013-10-10 10:49:29,你能幫幫我嗎?

                  But fechaNueva is giving me Thu Oct 10 10:49:29 CDT 2013 and I only want 2013-10-10 10:49:29, can you help me, please?

                  非常感謝,提前.

                  推薦答案

                  您根本不需要使用子字符串,因為您的 format 不包含該信息.

                  You do not need to use substring at all since your format doesn't hold that info.

                  SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                  String fechaStr = "2013-10-10 10:49:29.10000";  
                  Date fechaNueva = format.parse(fechaStr);
                  
                  System.out.println(format.format(fechaNueva)); // Prints 2013-10-10 10:49:29
                  

                  這篇關于如何將 java.sql.Timestamp(yyyy-MM-dd HH:mm:ss.S) 格式化為日期(yyyy-MM-dd HH:mm:ss)的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 原語?)

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

                            <tfoot id='vD98s'></tfoot>
                              <tbody id='vD98s'></tbody>
                          • <legend id='vD98s'><style id='vD98s'><dir id='vD98s'><q id='vD98s'></q></dir></style></legend>

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

                          • 主站蜘蛛池模板: 欧美黄色一区 | 亚洲 欧美 日韩在线 | 欧美日韩国产精品一区 | 亚洲精品视频免费 | 精品国产高清一区二区三区 | 黄色一级特级片 | 黑人性hd | 久久久影院 | 久久久青草婷婷精品综合日韩 | 天天拍天天操 | 欧美日韩综合一区 | 黑人巨大精品欧美一区二区免费 | 国产精品高潮呻吟久久av黑人 | 91视频88av | 国产精品一区二区三区四区 | 日韩激情免费 | 99久久婷婷国产综合精品电影 | 日本久久精品视频 | 午夜影晥| 91久久精品国产91久久性色tv | 欧美国产中文 | 美女福利视频网站 | 国产精品久久国产精品 | 日本特黄特色aaa大片免费 | 亚洲视频二 | 日韩欧美国产精品一区 | 精品久久久一区二区 | 天天插天天操 | 欧美亚洲视频 | 亚洲欧美日韩一区二区 | 九九热精品在线视频 | 亚洲精品免费在线 | 日韩欧美视频网站 | 国产午夜av片 | avav在线看 | 91精品导航 | 欧美女优在线观看 | 国产精品亚洲视频 | 51ⅴ精品国产91久久久久久 | 91青青草视频 | 欧美一区二区三区的 |