美文网首页
获取时间格式为YYYYMMDDHHMMSS

获取时间格式为YYYYMMDDHHMMSS

作者: 轩_7ca0 | 来源:发表于2019-07-22 14:58 被阅读0次

             const nowstr = new Date();

              const datenow = nowstr.getFullYear()

                        + ((nowstr.getMonth() + 1) < 10 ? "0" : "") + (nowstr.getMonth() + 1)

                        + (nowstr.getDate() < 10 ? "0" : "") + nowstr.getDate()

                        + (nowstr.getHours() < 10 ? "0" : "") + nowstr.getHours()

                        + (nowstr.getMinutes() < 10 ? "0" : "") + nowstr.getMinutes()

                        + (nowstr.getSeconds() < 10 ? "0" : "") + nowstr.getSeconds();

    console.log(datenow)

    201907220000

    相关文章

      网友评论

          本文标题:获取时间格式为YYYYMMDDHHMMSS

          本文链接:https://www.haomeiwen.com/subject/uwhwlctx.html