Toggle navigation
技术博客
首页
Java
Spring
DB
服务器
JS
软件
微语
留言
登录
当前位置:
首页
JS
Jquery获取当前系统时间
Jquery获取当前系统时间
2020-01-03 11:56:22
字数:769
516
次
JS
**下面就是如何获取系统当前时间的方法:** ```· function getFormatDate() { var date = new Date(); var month = date.getMonth() + 1; var strDate = date.getDate(); var hours = date.getHours(); var minutes = date.getMinutes(); var seconds = date.getSeconds(); if (month >= 1 && month <= 9) { month = "0" + month; } if (strDate >= 0 && strDate <= 9) { strDate = "0" + strDate; } if (hours >= 0 && hours <= 9) { hours = "0" + hours; } if (minutes >= 0 && minutes <= 9) { minutes = "0" + minutes; } if (seconds >= 0 && seconds <= 9) { seconds = "0" + seconds; } return date.getFullYear() + "-" + month + "-" + strDate + " " + date.getHours() + ":" + minutes + ":" + seconds; } ```
给我留言吧
昵称*
提交评论
留言板
目录
微信
分类
Nginx
系统
文学
生活
历史
地理
学习网站
nginx资源站
runoob学习网
redis学习网
vue中文网
dubbo
返回顶部
×
登录/注册
用户名
昵称
密码
确认密码
提交
没有账号?
马上注册
提交
已有账号?
去登录