问题描述 :将时间戳转换成 12月2日 11:55-11:56 这种格式
(时间戳:1543722948000 ,1543722986000)
问题描述 :将时间戳转换成 12月2日 11:55-11:56 这种格式
(时间戳:1543722948000 ,1543722986000)
//日期格式化
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() + ""));
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;
}
new Date(1543722948000).Format('MM月dd日 hh:mm'); //"12月02日 11:55"
new Date(1543722986000).Format('MM月dd日 hh:mm'); //"12月02日 11:56"
13 回答13k 阅读
7 回答2.1k 阅读
5 回答1.4k 阅读
3 回答1.3k 阅读✓ 已解决
5 回答1.6k 阅读✓ 已解决
6 回答1.2k 阅读✓ 已解决
2 回答1.4k 阅读✓ 已解决