当前位置:网站首页>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>边栏推荐
猜你喜欢

Static details of static members

微信小程序剪切图片的功能

Sword finger offer II 052. flatten binary search tree (simple binary search tree DFS)

Ruiji takeout - background login function development
![[LiteratureReview]Object Detection and Mapping with Bounding Box Constraints](/img/37/7cb5fa3a9078a5f5947485147c819d.png)
[LiteratureReview]Object Detection and Mapping with Bounding Box Constraints

SQL injection less34 (post wide byte injection + Boolean blind injection)
![[Ruiji takeout project]day4 - dish management](/img/2a/2d9deb7a583aa37b38a67ef2c74ee7.png)
[Ruiji takeout project]day4 - dish management

Imx6q GPIO multiplexing

Establishment of Ruiji takeout development environment

【CVPR 2021】Cylinder3D:用于LiDAR点云分割的圆柱体非对称3D卷积网络
随机推荐
Jmeter 安装第三方插件 Plugins Manager
PaddleNLP基于ERNIR3.0文本分类以CAIL2018-SMALL数据集罪名预测任务为例【多标签】
Sword finger offer II 052. flatten binary search tree (simple binary search tree DFS)
JS array merging, de duplication, dimensionality reduction (es6: extended operator, set)
Jianzhi offer II 062. implement prefix tree (medium design dictionary tree prefix tree string)
Lotus 1.16.0 extend sector expiration time
JS convert numbers to letters
[CVPR 2021] cylinder3d: cylindrical asymmetric 3D convolution network for LIDAR point cloud segmentation
Sword finger offer II 067. maximum XOR (medium prefix tree bit operation array)
Concise history of graphic technology
vuejs中如何实现动态路由切换及路由的缓存
Mysql8.0 cannot authorize users or prompt you are not allowed to create a user with grant
96. Different binary search trees (medium binary search tree dynamic planning)
Research cup element recognition multi label classification task based on ernie-3.0 cail2019 method
Win11 how to open software notification
Leetcode question brushing series - sum of majority type
Sword finger offer II 054. Sum of all values greater than or equal to nodes (medium binary search tree DFS)
For loops and functions
Is mov format a still image file format
ECMASript 5/6 笔记