js获取当前时间,时间格式化

您所在的位置:网站首页 js里获取当前时间 js获取当前时间,时间格式化

js获取当前时间,时间格式化

2023-12-13 15:25| 来源: 网络整理| 查看: 265

JS入门到精通完整版

?? Uriel Loong: 感觉挺全面的,有空配合网课再看

js获取当前时间,时间格式化

山水中一渔夫: [code=javascript] Date.prototype.Format = function (fmt) { var o = { "M+": this.getMonth() + 1, //月份 "d+": this.getDate(), //日 "H+": this.getHours(), //小时 "m+": this.getMinutes(), //分 "s+": this.getSeconds(), //秒 "q+": Math.floor((this.getMonth() + 3) / 3), //季度 "S": this.getMilliseconds() //毫秒 }; if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)); for (var k in o) if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length))); return fmt; [/code] 笑死,我给你补充一下缺失方法

JS入门到精通完整版

是草莓果酱猫吗: a 1 console.log(a,a++,++a) VM346:1 1 1 3 console.log(a,a--,--a) VM373:1 3 3 1

js获取当前时间,时间格式化

理塘纯真少年: 笑死,一开始我还觉得评论离谱,试了代码发现是文章离谱。

JS入门到精通完整版

fgfhgjf: 温故而知新,写的很全面



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3