<!--
/**
* For date extension, convert date to STR in the specified formatInchg
* Month (M), Day (d), 12 hours (h), 24 hours (h), Min (M), SEC (s), Week (E), quarter (q)OKwith 1-2 placeholders
* Year (y) can use 1-4 placeholders, milliseconds (S) only with 1 placeholders (1-3 digits)
* Eg:
* (New Date ()). Pattern ("Yyyy-mm-dd hh:mm:ss. S ") ==> 2006-07-02 08:09:04.423
* (New Date ()). Pattern ("Yyyy-mm-dd E HH:mm:ss") ==> 2009-03-10 II 20:09:04
* (New Date ()). Pattern ("Yyyy-mm-dd EE hh:mm:ss") ==> 2009-03-10 Tuesday 08:09:04
* (New Date ()). Pattern ("Yyyy-mm-dd EEE hh:mm:ss") ==> 2009-03-10 Tuesday 08:09:04
* (New Date ()). Pattern ("yyyy-m-d h:m:s.s") ==> 2006-7-2 8:9:4.18
*/
date.prototype.pattern=function (FMT) {
var o = {
"m+": This.getmonth () +1,//month
"d+": this.getdate (),//day
"H +": this.gethours ()%12 = = 0? 12:this.gethours ()%12,//hour
"H +": this.gethours (),//hour
"m+": this.getminutes (),//min
"s+": This.getseconds (),//Sec
"q+": Math.floor ((This.getmonth () +3)/3),//Quarterly
"S": this.getmilliseconds ()//MS
};
var week = {
" 0": "\u65e5",
" 1": "\u4e00",
" 2": "\u4e8c",
" 3": "\u4e09",
" 4": "\u56db",
" 5": "\u4e94",
"6": "\U516D"
};
if (/(y+)/.test (FMT)) {
Fmt=fmt.replace (regexp.$1, (this.getfullyear () + ""). substr (4-regexp.$1.length));
}
if (/(e+)/.test (FMT)) {
Fmt=fmt.replace (regexp.$1, (regexp.$1.length>1)? (regexp.$1.length>2?) "\u661f\u671f": "\u5468"): "") +week[this.getday () + ""]);
}
For(var k in o) {
if (New RegExp ("(" + K + ")"). Test (FMT)) {
FMT = Fmt.replace (regexp.$1, (regexp.$1.length==1)? (O[k]): (("XX" + o[k]). substr (("" + O[k]).));
}
}
return FMT;
}
//var date = new Date ();
//Window. Alert (Date.pattern ("Yyyy-mm-dd hh:mm:ss"));
//-->