当前位置:网站首页>JS获取当前时间(年月日时分秒)
JS获取当前时间(年月日时分秒)
2022-07-28 20:51:00 【让我打个盹】
HTML代码
<p id="time"></p>
js代码
<script>
var time = document.getElementById("time")
function show() {
let date = new Date();
let year = date.getFullYear(); //获取当前年份
let mon = date.getMonth() + 1; //获取当前月份
let da = date.getDate(); //获取当前日
let h = date.getHours(); //获取小时
let m = date.getMinutes(); //获取分钟
let s = date.getSeconds(); //获取秒
time.innerText = `${year} ${mon} ${da} ${h}:${m}:${s}`;
}
setInterval("show()", 1000);
</script>
边栏推荐
- 基于Ernie-3.0 CAIL2019法研杯要素识别多标签分类任务
- 使用webWorker执行后台任务
- Awk blank line filtering
- npm ERR code ETIMEDOUT npm ERR syscall connect npm ERR errno ETIMEDOUT npm ERR network reques...
- Sword finger offer II 058. schedule (medium design segment tree treemap ordered set)
- Win11怎么打开软件通知
- MySQL built-in functions
- Baidu map usage
- Ngx+sql environment offline installation log (RPM installation)
- Sword finger offer II 066. sum of words (medium prefix tree design string)
猜你喜欢
The function of wechat applet to cut pictures
SQL injection less42 (post stack injection)
微信小程序剪切图片的功能
Win11怎么打开软件通知
How do we do full link grayscale on the database?
98. Verify binary search tree (medium binary search tree DFS)
【CVPR 2021】Cylinder3D:用于LiDAR点云分割的圆柱体非对称3D卷积网络
(翻译)图技术简明历史
6K6w5LiA5qyh5pS75Ye75YiG5p6Q
mysql create语句能不能用来建立表结构并追加新的记录
随机推荐
75. Color classification (medium array double pointer sorting)
Netease Yunxin 2022q2 product supply station, come and get your product supply plan!
mysql8.0无法给用户授权或提示You are not allowed to create a user with GRANT的问题
lotus 1.16.0 延长扇区过期时间
CMD common commands
Closure, prototype and original link
Changes in the history of oscilloscope development
Excel-VBA 快速上手(十三、日期的常见用法)
776. 字符串移位包含问题
NPM switch Taobao source (NPM source)
32. Longest valid bracket (difficult stack string)
MOV格式是不是静态图像文件格式
Sword finger offer II 052. flatten binary search tree (simple binary search tree DFS)
79. Word search (medium string array matrix backtracking)
容器化配置启动redis集群 单机6节点 3主3从
Concise history of graphic technology
微信小程序里button点击的时候会边框有黑线
[binary tree] pseudo palindrome path in binary tree
JS convert numbers to letters
Mysql内置函数