zoukankan      html  css  js  c++  java
  • js常用的时间值

    js常用的时间值

    1.获取今天的0时0分0秒(常用于开始日期的获取)

    var startDate= new Date(new Date().toLocaleDateString()); //Tue May 15 2018 00:00:00 GMT+0800 (中国标准时间)
    

    2.获取一个月前的日期

    var lastM =new Date(new Date().setMonth(new Date().getMonth()-1));//Sun Apr 15 2018 09:18:08 GMT+0800 (中国标准时间)
    

    3.获取一个月前的0时0分0秒

    var lastM_start =new Date(new Date(new Date().toLocaleDateString()).setMonth(new Date().getMonth()-1));
    

    4.获取今天的23时59分59秒

    var endDate = new Date(new Date(new Date().toLocaleDateString()).getTime()+24*60*60*1000-1);
    

    5.获取昨天的23时59分59秒

    var yes_endDate = new Date(new Date(new Date(new Date().setDate(new Date().getDate()-1)).toLocaleDateString()).getTime()+24*60*60*1000-1);
    

      

  • 相关阅读:
    spring-boot4
    spring-boot3代码
    spring-boot3
    spring-boot2代码
    spring-boot2
    Java Socket编程
    eclipse项目中.classpath文件详解
    spring-boot1
    ASCII 在线转换器
    如何在Android开发中让你的代码更有效率
  • 原文地址:https://www.cnblogs.com/momozjm/p/12663763.html
Copyright © 2011-2022 走看看