uniapp拼团倒计时函数


            limitFormatTime(date) {
				var that=this;
			    // 日期格式为 [2019-05-09 20:10:10]
			    date = date.replace(/\-/g,'/');
			    var timestamp = (new Date(date)).valueOf();
			    var nowstr = (new Date()).valueOf();
				setInterval(function(){
					nowstr=nowstr-1000
				},1000)
			    var chazhi = (timestamp - nowstr)/1000;
			    if (chazhi < 0) {
			        chazhi = 0;
			    }
			    var d = Math.floor(chazhi / 3600 / 24);
			    var h = Math.floor((chazhi / 3600) % 24);
			    var m = Math.floor((chazhi % 3600) / 60);
			    var s = Math.floor((chazhi % 3600) % 60);
			    if (h < 10) {
			        h = "0" + h;
			    }
			    if (m < 10) {
			        m = "0" + m;
			    }
			    if (s < 10) {
			        s = "0" + s;
			    }
				
				return d + "天" + h + "时" + m + "分" + s + "秒"
			}                

  

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM