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

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

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

        Javascript - 将日期字符串重新格式化为 ISO8601

        时间:2023-08-07
        <i id='C6VMF'><tr id='C6VMF'><dt id='C6VMF'><q id='C6VMF'><span id='C6VMF'><b id='C6VMF'><form id='C6VMF'><ins id='C6VMF'></ins><ul id='C6VMF'></ul><sub id='C6VMF'></sub></form><legend id='C6VMF'></legend><bdo id='C6VMF'><pre id='C6VMF'><center id='C6VMF'></center></pre></bdo></b><th id='C6VMF'></th></span></q></dt></tr></i><div id='C6VMF'><tfoot id='C6VMF'></tfoot><dl id='C6VMF'><fieldset id='C6VMF'></fieldset></dl></div>
          <bdo id='C6VMF'></bdo><ul id='C6VMF'></ul>

                <tbody id='C6VMF'></tbody>

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

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

                  本文介绍了Javascript - 将日期字符串重新格式化为 ISO8601的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我有一个这样的字符串:

                  I have a string like this:

                  21.03.2016 23:59
                  

                  我需要将此字符串转换为 ISO-8601 日期时间字符串:

                  And I need this string converted into a ISO-8601 date-time string:

                  YYYY-MM-DDTHH:mm:ss+00:00
                  

                  有没有简单的方法来转换这个日期?我尝试使用 moment.js,但找不到解析现有日期的函数.

                  Is there a simple way to convert this date? I try it whit moment.js but i can't find a function to parse an existing date.

                  推荐答案

                  你也可以不使用 moment.js 来做到这一点.看代码如下:

                  You can also do this without using moment.js. Look code as following:

                  (new Date("03.21.2016 23:59")).toISOString()
                  

                  只需将字符串 21.03.2016 23:59 (dd-mm-yyyy) 更改为 03.21.2016 23:59 (mm-dd-yyyy).您可以通过拆分日期并更改拆分部分的顺序轻松做到这一点.

                  just you need to change your string 21.03.2016 23:59 (dd-mm-yyyy) to 03.21.2016 23:59 (mm-dd-yyyy). You can easily do this by split the date and change the order of split part.

                  如果您不想这样做,那么只需按照 matthias 的回答使用 moment.js.

                  And if you dont want to do this then simply use moment.js as per matthias's answer.

                  这篇关于Javascript - 将日期字符串重新格式化为 ISO8601的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:Firebase.ServerValue.TIMESTAMP 在侦听器和实际添加数据 下一篇:正则表达式验证时间戳

                  相关文章

                  最新文章

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

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

                    <tfoot id='ncY7t'></tfoot>

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

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