zoukankan      html  css  js  c++  java
  • js 获取当前时间前几分钟

    function getNowFormatDate() {
                var date = new Date();
                var seperator1 = "-";
                var seperator2 = ":";
                //前十分钟时间
                 var minutes=parseInt("10");  
    
              var   interTimes=minutes*60*1000;
    
              var interTimes=parseInt(interTimes);  
                 date=new   Date(Date.parse(date)-interTimes);
                
                var month = date.getMonth() + 1;
                var strDate = date.getDate();
                var hour = date.getHours();
                var minutes = date.getMinutes();
                if (month >= 1 && month <= 9) {
                    month = "0" + month;
                }
                if (strDate >= 0 && strDate <= 9) {
                    strDate = "0" + strDate;
                }
                if (hour >= 0 && hour <= 9) {
                        hour = "0" + hour;
                }
                if (minutes >= 0 && minutes <= 9) {
                        minutes = "0" + minutes;
                }
                var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
                        + " " + hour + seperator2 + minutes
                        + seperator2 + date.getSeconds();
                return currentdate;
            }
  • 相关阅读:
    微信jssdk录音功能开发记录
    前端自动化 模块化开发
    git常用命令
    RESTful
    web前端和SEO优化
    论get和post的区别。。
    Mac 用pecl安装PHP扩展失败
    git
    fullPage.js 的使用
    正则表达式
  • 原文地址:https://www.cnblogs.com/Byme/p/15499375.html
Copyright © 2011-2022 走看看