1 Star 0 Fork 0

siYuanJun/web-library

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
实时动态时间.js 788 Bytes
Copy Edit Raw Blame History
siYuanJun authored 2019-09-16 10:16 . Create 实时动态时间.js
window.onload = function () {
var show = document.getElementById("show");
setInterval(function () {
var time = new Date();
// 程序计时的月从0开始取值后+1
var m = time.getMonth() + 1;
var d = time.getDate();
var h = time.getHours();
var mt = time.getMinutes();
var ms = time.getSeconds();
if (m < 10) {
m = '0' + m;
}
if (d < 10) {
d = '0' + d;
}
if (h < 10) {
h = '0' + h;
}
if (mt < 10) {
mt = '0' + mt;
}
if (ms < 10) {
ms = '0' + ms;
}
var t = time.getFullYear() + "-" + m + "-" + d + " " + h + ":" + mt + ":" + ms;
show.innerHTML = t;
}, 1000);
};
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/siYuanJun/web-library.git
git@gitee.com:siYuanJun/web-library.git
siYuanJun
web-library
web-library
master

Search