• <tfoot id='nutby'></tfoot>

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

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

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

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

        正则表达式验证时间戳

        时间:2023-08-07
        • <legend id='1gs3N'><style id='1gs3N'><dir id='1gs3N'><q id='1gs3N'></q></dir></style></legend>

          <small id='1gs3N'></small><noframes id='1gs3N'>

            <tbody id='1gs3N'></tbody>

          <tfoot id='1gs3N'></tfoot>
            <bdo id='1gs3N'></bdo><ul id='1gs3N'></ul>

                  <i id='1gs3N'><tr id='1gs3N'><dt id='1gs3N'><q id='1gs3N'><span id='1gs3N'><b id='1gs3N'><form id='1gs3N'><ins id='1gs3N'></ins><ul id='1gs3N'></ul><sub id='1gs3N'></sub></form><legend id='1gs3N'></legend><bdo id='1gs3N'><pre id='1gs3N'><center id='1gs3N'></center></pre></bdo></b><th id='1gs3N'></th></span></q></dt></tr></i><div id='1gs3N'><tfoot id='1gs3N'></tfoot><dl id='1gs3N'><fieldset id='1gs3N'></fieldset></dl></div>
                • 本文介绍了正则表达式验证时间戳的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我需要一个正则表达式来验证格式的时间戳,使用 Javascript:

                  I need a regular expression to validate a timestamp of the format, using Javascript:

                  YYYY/MM/DD HH:MI:SS

                  YYYY/MM/DD HH:MI:SS

                  我尝试了一些,但似乎我的正则表达式技能无法涵盖某些内容.

                  I tried cooking up a few, but seems my regex skills fail to cover something or other.

                  请给我一个参考或方法.

                  Please give me a reference or way to do it.

                  附注: 我提到正则表达式,只是作为一个建议.我使用 Javascript,欢迎任何替代方案.

                  推荐答案

                  我建议使用 Datejs这.不需要自己解析日期,并且正则表达式不足以验证时间戳.使用 datejs,您可以解析日期中的字符串,如果它无效,您将得到 null:

                  I would recommend to use Datejs for this. Parsing the date yourself is not necessary and a Regex is not enough to validate a timestamp. With datejs you could parse the string in a date and you'll get null if its invalid:

                  Date.parse("2009/06/29 13:30:10", "yyyy/MM/dd HH:mm:ss");
                  

                  这篇关于正则表达式验证时间戳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:Javascript - 将日期字符串重新格式化为 ISO8601 下一篇:Moment.js amDateFormat 总是返回 1970 年的日期

                  相关文章

                  最新文章

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

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

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

                  1. <tfoot id='A6Rja'></tfoot>