date.prototype.format = function(format) { //author: meizz
let o = {
"m+": this.getmonth() + 1, //月份
"d+": this.getdate(), //日
"h+": this.gethours(), //小时
"m+": this.getminutes(), //分
"s+": this.getseconds(), //秒
"q+": math.floor((this.getmonth() + 3) / 3), //季度
"f+": this.getmilliseconds() //毫秒
};
if (/(y+)/.test(format))
format = format.replace(regexp.$1, (this.getfullyear() + "").substr(4 - regexp.$1.length));
for (let k in o)
if (new regexp("(" + k + ")").test(format))
format = format.replace(regexp.$1, (regexp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
return format;
};
var d=new date();
d.format('yyyy/mm/dd hh:mm');
//"2016/11/25 10:01"