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分钟
  • 相关阅读:
    vue动态组件
    服务端渲染和nuxt简单介绍
    nuxt Window 或 Document未定义解决方案
    知乎专栏开放性api
    小程序的一些坑
    搭建微服务器(续)
    调研pwa和sw
    mysql索引原理以及优化
    装饰器
    斐波那契数列和小青蛙跳跳跳问题
  • 原文地址:https://www.cnblogs.com/mahmud/p/11910146.html
Copyright © 2011-2022 走看看