zoukankan      html  css  js  c++  java
  • 各种日期格式化返回

    // 日期格式化返回 2019-04-01
    export function getGangDate(dates) {
      if (dates) {
        const dateNew = new Date(dates)
        const y = dateNew.getFullYear()
        const m = dateNew.getMonth() + 1
        const d = dateNew.getDate()
        return y + '-' + (m < 10 ? '0' + m : m) + '-' + (d < 10 ? '0' + d : d)
      }
    }
    // 日期格式化返回 2019-04-01 12:11:23
    export function getGangDateMiao(dates) {
      if (dates) {
        const dateNew = new Date(dates)
        const y = dateNew.getFullYear()
        const m = dateNew.getMonth() + 1
        const d = dateNew.getDate()
        const h = dateNew.getHours()
        const f = dateNew.getMinutes()
        const mm = dateNew.getSeconds()
        return y + '-' + (m < 10 ? '0' + m : m) + '-' + (d < 10 ? '0' + d : d) + ' ' + (h < 10 ? '0' + h : h) + ':' + (f < 10 ? '0' + f : f) + ':' + (mm < 10 ? '0' + mm : mm)
      }
    }
    // 日期格式化返回2019年04月01日
    export function getWenDate(dates) {
      const dateNew = new Date(dates)
      const y = dateNew.getFullYear()
      const m = dateNew.getMonth() + 1
      const d = dateNew.getDate()
      return y + '年' + (m < 10 ? '0' + m : m) + '月' + (d < 10 ? '0' + d : d) + '日'
    }
  • 相关阅读:
    Swagger2文档生成器
    SSM中spring配置文件
    REDTful风格设计接口
    xss练习
    使用burp绕过token爆破用户名密码
    简单的内网渗透实验
    XSS Challenges
    一次简单的渗透
    vim进阶学习
    kali的部分学习
  • 原文地址:https://www.cnblogs.com/lst619247/p/10668927.html
Copyright © 2011-2022 走看看