zoukankan      html  css  js  c++  java
  • JavaScript获取距离某天前或后的日期

    /**
    * param  Date Object:Mon May 11 13:53:08 UTC+0800 2015 
    * n 自param 起向后多少天
    * return Date Object:Mon May 11 13:53:08 UTC+0800 2015
    */
    function getDateBeforeParamDate(param,n){
    var result = new Date();
    if(param==null){
    param = result;
    }
    if(n==null){
    n=0;
    }
    param = new Date(param);
    millSecond = param.valueOf();
    millSecond =  millSecond - n*24*3600*1000;
    result = new Date(millSecond);
    result = getTodayFormatea(result);
    return result;
    }
    /**
    * param  Date对象:Mon May 11 13:53:08 UTC+0800 2015 
    * n 自param 向前多少天
    * return Date Object:Mon May 11 13:53:08 UTC+0800 2015
    */
    function getDateNextParamDate(param,n){
    var result = new Date();
    if(param==null){
    param = result;
    }
    if(n==null){
    n=0;
    }
    param = new Date(param);
    millSecond = param.valueOf();
    millSecond = millSecond + n*24*3600*1000;
    result = new Date(millSecond);
    result = getTodayFormatea(result);
    return result;
    }
  • 相关阅读:
    gcc相关
    test
    第二次课
    VS快捷键
    第7章 站在对象模型的尖端
    第6章 执行期语意学
    第5章 构造, 析构, 拷贝语意学
    第4章 Function语意学
    第一次课
    第3章 Data语意学
  • 原文地址:https://www.cnblogs.com/telwanggs/p/5306228.html
Copyright © 2011-2022 走看看