javascript——获取当前日期

2021-09-09

let date = new Date();
    let seperator1 = "-";
    let year = date.getFullYear();
    let month: any = date.getMonth() + 1;
    let strDate: any = date.getDate();
    if (month >= 1 && month <= 9) {
      month = "0" + month;
    }
    if (strDate >= 0 && strDate <= 9) {
      strDate = "0" + strDate;
    }
    let endTime = year + seperator1 + month + seperator1 + strDate;
上一篇:获取本月往后一年的日期月份信息


下一篇:25-DockerFile介绍