日期
发布日期:2022-07-08 02:55:59
浏览次数:39
分类:技术文章
本文共 426 字,大约阅读时间需要 1 分钟。
var now = new Date();
method | use |
---|---|
console.log(now.getTime()); | 返回从传入的时间到1970年1月1日的毫秒数 |
console.log(now.getFullYear()); | 拿到当前对象的年份 |
console.log(now.getMonth()); | 拿到当前对象的月份 |
console.log(now.getDate()); | 拿到当前对象的日 |
console.log(now.getDay()); | 星期 0代表周日 |
console.log(now.getHours()); | 小时 0 (午夜) 到 23 |
console.log(now.getMinutes()); | 分钟 返回值是 0 ~ 59 之间的一个整数 |
console.log(now.getSeconds()); | 秒 返回值是 0 ~ 59 之间的一个整数 |
s =s<10?"0"+s:s; | 个位数的时候前面补个0 00:00:00 |
转载地址:https://blog.csdn.net/qq_45631813/article/details/102593766 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
感谢大佬
[***.8.128.20]2024年04月24日 14时07分24秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
LinuxGPIO操作和MTK平台GPIO
2021-06-30
Linux下的图形库curses写贪吃蛇,酷
2021-06-30
在asp.net中为Web用户控件添加属性和事件
2021-06-30
datagrid的正反双向排序
2021-06-30
在分页状态下删除纪录的问题
2021-06-30
使用DataGrid动态绑定DropDownList
2021-06-30
DataGrid删除确认及Item颜色交替
2021-06-30
NetBeans配置Xdebug 远程调试PHP
2021-06-30
MediaWiki安装
2021-06-30
Squid安装
2021-06-30
如何查看当前Linux的版本
2021-06-30
Ubuntu安装Nginx
2021-06-30
Ubuntu 下安装thttpd Web服务器
2021-06-30
用thttpd做Web Server
2021-06-30
服务器端开发经验总结 Linux C语言
2021-06-30
将网站程序放在tmpfs下
2021-06-30
使用Nginx的proxy_cache缓存功能取代Squid
2021-06-30
nginx 反向代理,动静态请求分离,proxy_cache缓存及缓存清除
2021-06-30
nginx 的proxy_cache才是王道
2021-06-30
Nginx proxy_cache 使用示例
2021-06-30