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

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

    <tfoot id='rz7g4'></tfoot>
    <legend id='rz7g4'><style id='rz7g4'><dir id='rz7g4'><q id='rz7g4'></q></dir></style></legend>

      如何在java中将mm/dd/yyyy转换为yyyy-mm-dd

      时间:2023-09-29

        <tbody id='Prvsu'></tbody>

      <tfoot id='Prvsu'></tfoot>
        • <small id='Prvsu'></small><noframes id='Prvsu'>

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

              <i id='Prvsu'><tr id='Prvsu'><dt id='Prvsu'><q id='Prvsu'><span id='Prvsu'><b id='Prvsu'><form id='Prvsu'><ins id='Prvsu'></ins><ul id='Prvsu'></ul><sub id='Prvsu'></sub></form><legend id='Prvsu'></legend><bdo id='Prvsu'><pre id='Prvsu'><center id='Prvsu'></center></pre></bdo></b><th id='Prvsu'></th></span></q></dt></tr></i><div id='Prvsu'><tfoot id='Prvsu'></tfoot><dl id='Prvsu'><fieldset id='Prvsu'></fieldset></dl></div>
                本文介绍了如何在java中将mm/dd/yyyy转换为yyyy-mm-dd的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我将输入日期作为字符串输入 mm/dd/yyyy 并希望将其转换为 yyyy-mm-dd我试试这段代码

                i am getting input date as String into mm/dd/yyyy and want to convert it into yyyy-mm-dd i try out this code

                Date Dob = new SimpleDateFormat("yyyy-mm-dd").parse(request.getParameter("dtDOB"));
                

                推荐答案

                好吧 - 你已经陷入了 java 日期格式最常见的陷阱之一:

                OK - you've fallen for one of the most common traps with java date formats:

                • mm分钟
                • MM
                • mm is minutes
                • MM is months

                您已将月份解析为分钟.相反,将模式更改为:

                You have parsed months as minutes. Instead, change the pattern to:

                Date dob = new SimpleDateFormat("yyyy-MM-dd").parse(...);
                

                然后输出,再次确保您使用 MM 几个月.

                Then to output, again make sure you use MM for months.

                String str = new SimpleDateFormat("dd-MM-yyyy").format(dob);
                

                这篇关于如何在java中将mm/dd/yyyy转换为yyyy-mm-dd的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:如何告诉 Eclipse 不格式化代码文件的一部分(按 下一篇:java.awt.EventQueue.invokeLater 解释

                相关文章

                最新文章

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

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

                  <tfoot id='qI7Wf'></tfoot>

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