zoukankan      html  css  js  c++  java
  • moment.js获取本周本月本年的开始日期和结束日期

    //获取本日
      const startDate = moment().format('YYYY-MM-DD'); 
      const startDate = moment().format('YYYY-MM-DD');
    //获取本周
     const startDate = moment().week(moment().week()).startOf('week').format('YYYY-MM-DD');   //这样是年月日的格式
     const endDate = moment().week(moment().week()).endOf('week').valueOf(); //这样是时间戳的格式
              
    //获取本月 
      const startDate = moment().month(moment().month()).startOf('month').valueOf();
      const endDate = moment().month(moment().month()).endOf('month').valueOf();
              
     //获取本年
      const startDate = moment().year(moment().year()).startOf('year').valueOf();
      const endDate = moment().year(moment().year()).endOf('year').valueOf();
    
  • 相关阅读:
    C#数组添加元素
    C#数组排序方法
    C#遍历数组
    C#动态数组ArrayList
    C#传递数组参数
    基础题(四)
    基础题(三)
    CMDB概述(二)
    CMDB概述(一)
    Django(基础篇)
  • 原文地址:https://www.cnblogs.com/lml-lml/p/9935434.html
Copyright © 2011-2022 走看看