zoukankan      html  css  js  c++  java
  • 时间相加及当前时间

           //日期相加
            function addDate(curDate,day){
                var time = Date.parse(curDate)+24*60*60*1000*day;
                return new Date(time);
            }
            //当前日期
            function currentTime(date)
            {

                var year = date.getFullYear();       //年
                var month = date.getMonth() + 1;     //月
                var day = date.getDate();            //日

                var hh = date.getHours();            //时
                var mm = date.getMinutes();          //分
                var ss = date.getSeconds();          //秒
                var clock = year + "-";

                if(month < 10)
                    clock += "0";

                clock += month + "-";

                if(day < 10)
                    clock += "0";

                clock += day + " ";

                if(hh < 10)
                    clock += "0";

                clock += hh + ":";
                if (mm < 10) clock += '0';
                clock += mm + ":";

                if(ss<10) clock += '0'
                clock += ss;
                return(clock);
            }

  • 相关阅读:
    搜索旋转排序数组
    SpringBoot整合mybatis
    《浪潮之巅》阅读笔记01
    阅读杂记01
    go home or stand up
    关于URL编码/javascript/js url 编码(轉)
    水晶报表 相关。
    Format函数(转)
    asp 亂碼問題。
    圣人不死,大盗不止
  • 原文地址:https://www.cnblogs.com/huixuexidezhu/p/5601180.html
Copyright © 2011-2022 走看看