zoukankan      html  css  js  c++  java
  • js 日期 处理 加减时分秒

    var _d = new Date("2018/01/01 12:00:00");
               _d = new Date(_d.valueOf() + 60 * 1000);// 当前时间加上1分钟
            var _d_year111 = _d.getFullYear();//
            var _d_month111 = _d.getMonth() + 1; //
                _d_month111 = (_d_month111 < 10 ? "0" + _d_month111 : _d_month111);
            var _d_day111 = _d.getDate(); //
                _d_day111 = (_d_day111 < 10 ? "0" + _d_day111 : _d_day111);
            var _d_hours111 = _d.getHours();
            var _d_minutes111 = _d.getMinutes();
            var _d_seconds111 = _d.getSeconds();
            if (_d_hours111 < 10) _d_hours111 = "0" + _d_hours111;
            if (_d_minutes111 < 10) _d_minutes111 = "0" + _d_minutes111;
            if (_d_seconds111 < 10) _d_seconds111 = "0" + _d_seconds111;        
    
            _data = _d_year111 + "-" + _d_month111.toString() + "-" + _d_day111 + " " + _d_hours111 + ":" + _d_minutes111 + ":" + _d_seconds111;
    var _d = new Date("2018/01/01 12:00:00");
          _d = new Date(_d.valueOf() + 60* 60 * 1000);// 当前时间加上1小时
    
          _d = new Date(_d.valueOf() - 60* 60 * 1000);// 当前时间减掉1小时
    
    
          _d = new Date(_d.valueOf() + 60 * 1000);// 当前时间加上1分钟
    
          _d = new Date(_d.valueOf() - 60 * 1000);// 当前时间减掉1分钟
  • 相关阅读:
    error: declaration of 'cv::Mat R ' shadows a parameter
    Java网络编程(二)
    排序算法(二)
    Java网络编程(一)
    排序算法(一)
    Python文件访问模式
    Python文件与异常
    递归
    SQL命令的六个主要类别
    iOS-生成Bundle包-引入bundle-使用bundle
  • 原文地址:https://www.cnblogs.com/mahmud/p/11910146.html
Copyright © 2011-2022 走看看