js获取当前月第一天和下个月第一天

      let date = new Date()
      let month = parseInt(date.getMonth() + 1)
      let year = date.getFullYear()
      let star_time = ''
      let end_time = ''
      let next_month = ''
      let cur_month = month < 10 ? '0' + month : month
      star_time = year + '-' + cur_month + '-01'
      if (date.getMonth() == 11) {
        end_time = Number(year) + 1 + '-01' + '-01'
      } else {
        next_month = parseInt(date.getMonth() + 2) < 10 ? '0' + parseInt(date.getMonth() + 2) : parseInt(date.getMonth() + 2)
        end_time = year + '-' + next_month + '-01'
      }
      console.log(star_time)
      console.log(end_time)
上一篇:[20150926]索引压缩问题.txt


下一篇:Mybatis源码分析之(二)根据配置文件创建SqlSessionFactory(Configuration的创建过程)