计时代码

正计时

<p id="loveSitetime" style="font-size: 1.0rem;"></p>
<script language="javascript">
        function loveSitetime() {
            window.setTimeout("loveSitetime()", 1000);
            var seconds = 1000
            var minutes = seconds * 60
            var hours = minutes * 60
            var days = hours * 24
            var years = days * 365
            var today = new Date()
            var todayYear = today.getFullYear()
            var todayMonth = today.getMonth() + 1
            var todayDate = today.getDate()
            var todayHour = today.getHours()
            var todayMinute = today.getMinutes()
            var todaySecond = today.getSeconds()
            // 时间设置
            var t1 = Date.UTC(2022, 01, 26, 00, 00, 00)
            var t2 = Date.UTC(todayYear, todayMonth, todayDate, todayHour, todayMinute, todaySecond)
            var diff = t2 - t1
            var diffYears = Math.floor(diff / years)
            var diffDays = Math.floor((diff / days) - diffYears * 365)
            var diffHours = Math.floor((diff - (diffYears * 365 + diffDays) * days) / hours)
            var diffMinutes = Math.floor((diff - (diffYears * 365 + diffDays) * days - diffHours * hours) / minutes)
            var diffSeconds = Math.floor((diff - (diffYears * 365 + diffDays) * days - diffHours * hours -
                diffMinutes * minutes) / seconds)
            document.getElementById("loveSitetime").innerHTML = "群晖使用:" + diffYears + "年" + diffDays + "天" +
                diffHours + "时" + diffMinutes + "分" + diffSeconds + "秒啦</br>"
        }
        loveSitetime()
        </script>
</div>
</ul>

倒计时

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<h1 id="hh"></h1>
	</body>
	<script type="text/javascript">
		function station(x,y,z){
			//当前时间
			var now = Date.now(),
				//结束时间
				end = new Date(x,y-1,z),
				ends = end.getTime();
			var ss = ends - now;
			var s = Math.floor(ss/1000);
			//相差天数
			var day = Math.floor(s / 60 / 60 / 24);
			//相差小时数
			var hours = Math.floor(s / 60 / 60 % 24);
			//相差分钟数
			var min = Math.floor(s / 60 % 60 );
			//相差秒数
			var sec = Math.floor(s % 60 );
			var html = "距离中过年假还有:"+day+"天"+hours+"时"+min+"分"+sec+"秒";
			hh.innerHTML = html;

		}
		station(2023,01,01);
		//一秒一次调用
		setInterval(function(){
			station(2023,01,01);
		},1000);
	</script>
	<style type="text/css">
		#hh{
			font-size: 25px;
			text-align: center;
		}
	</style>
</html>


车机adb

打开车机,找到电话,输入*#201301#*,进入车机测试界面
THE END
喜欢就支持一下吧
点赞1228
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片

    暂无评论内容