'); __ci.document.writeln('<\/style>'); __ci.document.writeln('<\/head>'); __ci.document.writeln(''); __ci.document.writeln('<\/body>'); __ci.document.writeln('<\/html>'); __ci.document.close(); }; /** * @param d the delimiter * @param p the pattern of your date * @author meizz * @author kimsoft add w+ pattern */ Date.prototype.format = function(style) { var o = { "M+" : this.getMonth() + 1, //month "d+" : this.getDate(), //day "h+" : this.getHours(), //hour "m+" : this.getMinutes(), //minute "s+" : this.getSeconds(), //second "w+" : "\u65e5\u4e00\u4e8c\u4e09\u56db\u4e94\u516d".charAt(this.getDay()), //week "q+" : Math.floor((this.getMonth() + 3) / 3), //quarter "S" : this.getMilliseconds() //millisecond } if (/(y+)/.test(style)) { style = style.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)); } for(var k in o){ if (new RegExp("("+ k +")").test(style)){ style = style.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length)); } } return style; }; /** * @param d the delimiter * @param p the pattern of your date * @rebuilder kimsoft * @version build 2006.12.15 */ String.prototype.toDate = function(delimiter, pattern) { delimiter = delimiter || "-"; pattern = pattern || "ymd"; var a = this.split(delimiter); var y = parseInt(a[pattern.indexOf("y")], 10); //remember to change this next century ;) if(y.toString().length <= 2) y += 2000; if(isNaN(y)) y = new Date().getFullYear(); var m = parseInt(a[pattern.indexOf("m")], 10) - 1; var d = parseInt(a[pattern.indexOf("d")], 10); if(isNaN(d)) d = 1; return new Date(y, m, d); };