//日期格式转换
            getCurrentTime() {
                var date = new Date();//当前时间
                var year = date.getFullYear() //返回指定日期的年份
                var month = this.repair(date.getMonth() + 1);//
                var day = this.repair(date.getDate());//
                var hour = this.repair(date.getHours());//
                var minute = this.repair(date.getMinutes());//
                var second = this.repair(date.getSeconds());//
                
                //当前时间 
                var curTime = year + "-" + month + "-" + day  + " " + hour + ":" + minute + ":" + second;
                return curTime;
            },
            //补0
             repair(i){
                if (i >= 0 && i <= 9) {
                    return "0" + i;
                } else {
                    return i;
                }
            },
            //日期比较大小
            CompareDate(d1,d2)
            {
              return ((new Date(d1.replace(/-/g,"\/"))) > (new Date(d2.replace(/-/g,"\/"))));
            }

 

posted on 2022-10-20 16:49  我炒菜不放盐  阅读(141)  评论(0编辑  收藏  举报