다음과 같이 코드 코드를 복사하십시오.
/**
* 시간 물체의 공식화;
*/
date.prototype.format = function (format) {
/*
* 예 : 형식 = "yyyy-mm-dd hh : mm : ss";
*/
var o = {
"m +": this.getmonth () + 1, // 월
"d+": this.getDate (), // day
"H+": this.gethours (), // 시간
"m+": this.getMinutes (), // 분
"s+": this.getSeconds (), // 두 번째
"Q +": Math.floor ((this.getMonth ()) + 3), // 쿼터
"S": this.getmilliseconds ()
// 밀리 초
}
if (//y+)/.test (format)) {{
format = format.replace (regexp. $ 1, (this.getsyear () + "")
.Substr (4 -regexp. $ 1.length);
}
for (var k in o) {
if (new regexp ( "("( " + k +")) ". test (format) {
형식 = format.replace (Regexp. $ 1, regexp. $ 1. length == 1? o [k]
: ( "00" + o [k]).
}
}
반환 형식;
}
다음과 같이 코드 코드를 복사하십시오.
var now = 새로운 날짜 ().
다음과 같이 코드 코드를 복사하십시오.
새 날짜 (). 형식 ( "yy-mm-dd hh : mm");