• 2020/6.30


    1.'2020-06-29 23:59:59'--> '6.29'

    let res='2020-06-29 23:59:59' //6.29
    let res1=res .slice(5).split(" ")[0].replace("-", ".")
    console.log(res1);

     2.  915998847=> 915,998,847

    const totalServiceTimes=915998847

    3.字符串数字

    const str = '10'
    const res = str * 1 //字符串数字转数字
    
    const num=20
    const res1=''+num //数字转为字符串数字

     4.js获取走动时间

    
    
    created() {
       this.timer = setInterval(this.getTime1, 1000);
    
    
      },


    methods: { getTime1() { const time
    = new Date(); let year = time.getFullYear(); //获取年份 let month = this.padZero(time.getMonth() + 1); //获取月份 let day = this.padZero(time.getDate()); //获取日期 let hour = this.padZero((time.getHours())); //获取时 let minute = this.padZero(time.getMinutes()); //获取分 let second = this.padZero(time.getSeconds()); //获取秒 this.currentTime = `${year}-${month}-${day} ${hour}:${minute}:${second}` }, padZero(num) { return ('' + num).padStart(2,'0') }, }

    5. 9->009->[0 ,0 ,9] ; 41->041->[0 ,4 ,1]

    function PrefixInteger(num, n) {
      let number = num ? (Array(n).join(0) + num).slice(-n) : 0;
      let numArr = String(number)
        .split("")
        .map(it => it * 1);
      return numArr;
    }
    console.log(PrefixInteger(9,3))

     function PrefixInteger(num,n=3){
        return (num+'').padStart(3,'0').split('').map(Number)

      }
  • 相关阅读:
    effective C++
    bat取时间间隔
    bat设置windows计划任务
    listener.ora 与 tnsnames.ora
    route(windows)
    bat 数组实现
    非const引用参数传入不同类型编译不过的理解(拒绝将临时对象绑定为非const的引用的形参是有道理的)
    python no module named builtins
    Caffe使用新版本CUDA和CuDNN
    Ubuntu16.04安装vim8
  • 原文地址:https://www.cnblogs.com/xiaoliziaaa/p/13212493.html
Copyright © 2020-2023  润新知