format(fmt) {
var date = fmt;
var Y = date.getFullYear() + '-';
var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
var D = date.getDate() + ' ';
var h = date.getHours() + ':';
var m = date.getMinutes() + ':';
var s = date.getSeconds();
var timers=Y + M + D + h + m + s;
console.log(timers);
return timers;
}
format(new Date())
// 输出结果:2014-04-23 18:55:49
网友评论