<tfoot id='R1HYD'></tfoot>

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

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

      1. 如何转换字符串“2011-11-29 12:34:25"迄今为止在

        时间:2023-09-29
        <tfoot id='MFDps'></tfoot>

            <tbody id='MFDps'></tbody>
        1. <legend id='MFDps'><style id='MFDps'><dir id='MFDps'><q id='MFDps'></q></dir></style></legend>

            • <small id='MFDps'></small><noframes id='MFDps'>

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

                  <i id='MFDps'><tr id='MFDps'><dt id='MFDps'><q id='MFDps'><span id='MFDps'><b id='MFDps'><form id='MFDps'><ins id='MFDps'></ins><ul id='MFDps'></ul><sub id='MFDps'></sub></form><legend id='MFDps'></legend><bdo id='MFDps'><pre id='MFDps'><center id='MFDps'></center></pre></bdo></b><th id='MFDps'></th></span></q></dt></tr></i><div id='MFDps'><tfoot id='MFDps'></tfoot><dl id='MFDps'><fieldset id='MFDps'></fieldset></dl></div>
                  本文介绍了如何转换字符串“2011-11-29 12:34:25"迄今为止在“dd-MM-yyyy"中JAVA格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在尝试将格式为yyyy-MM-dd HH:mm:ss"的日期转换为dd-MM-yyyy".

                  I am trying to convert date which is in string and got format of "yyyy-MM-dd HH:mm:ss" to "dd-MM-yyyy".

                  我已经实现了以下代码,但它给出了:java.lang.IllegalArgumentException

                  I have implmented following code but its giving : java.lang.IllegalArgumentException

                          SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
                          Date date = new Date(values);
                          String mydate = dateFormat.format(date);
                  

                  推荐答案

                  首先,您必须将日期时间的字符串表示形式解析为 Date 对象.

                  First you have to parse the string representation of your date-time into a Date object.

                  DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                  Date date = (Date)formatter.parse("2011-11-29 12:34:25");
                  

                  然后您将 Date 对象格式化回您喜欢的格式的字符串.

                  Then you format the Date object back into a String in your preferred format.

                  DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy");
                  String mydate = dateFormat.format(date);
                  

                  这篇关于如何转换字符串“2011-11-29 12:34:25"迄今为止在“dd-MM-yyyy"中JAVA格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:6位微/毫秒的java日期格式 下一篇:如何用前导零写入csv?

                  相关文章

                  最新文章

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

                    1. <legend id='baE72'><style id='baE72'><dir id='baE72'><q id='baE72'></q></dir></style></legend>

                        <bdo id='baE72'></bdo><ul id='baE72'></ul>
                    2. <small id='baE72'></small><noframes id='baE72'>