|
<script language="JavaScript"> Wt5Linux联盟 Date.prototype.format = function(format) //author: meizz Wt5Linux联盟 { Wt5Linux联盟 var o = { Wt5Linux联盟 "M+" : this.getMonth()+1, //month Wt5Linux联盟 "d+" : this.getDate(), //day Wt5Linux联盟 "h+" : this.getHours(), //hour Wt5Linux联盟 "m+" : this.getMinutes(), //minute Wt5Linux联盟 "s+" : this.getSeconds(), //second Wt5Linux联盟 "q+" : Math.floor((this.getMonth()+3)/3), //quarter Wt5Linux联盟 "S" : this.getMilliseconds() //millisecond Wt5Linux联盟 } Wt5Linux联盟 if(/(y+)/.test(format)) format=format.replace(RegExp.$1, Wt5Linux联盟 (this.getFullYear()+"").substr(4 - RegExp.$1.length)); Wt5Linux联盟 for(var k in o)if(new RegExp("("+ k +")").test(format)) Wt5Linux联盟 format = format.replace(RegExp.$1, Wt5Linux联盟 RegExp.$1.length==1 ? o[k] : Wt5Linux联盟 ("00"+ o[k]).substr((""+ o[k]).length)); Wt5Linux联盟 return format; Wt5Linux联盟 } Wt5Linux联盟 alert(new Date().format("yyyy-MM-dd hh:mm:ss")); Wt5Linux联盟 </script> Wt5Linux联盟
Linux联盟收集整理 ,转贴请标明原始链接,如有任何疑问欢迎来本站Linux论坛讨论 |
|