原生javascript操作cookie和日期格式的通用方法functionsetCookie(name,value){varDays=1;varexp=newDate();exp.setTime(exp.getTime()+Days*24*60*60*1000);exp.setHours(0);exp.setMinutes(0);exp.setSeconds(0);...
javascript毫秒转换成指定的日期时间格式varformat=function(time,format){vart=newDate(time);vartf=function(i){return(i<10?'0':'')+i};returnformat.replace(/yyyy|MM|dd|HH|mm|ss/g,function(a){switc...
javascript常用的Date对象扩展Date.getDaysInMonth=function(year,month){vardays=0;switch(month){case1:case3:case5:case7:case8:case10:case12:days=31break;case4:case6:case9:case11:days=30...
//扩展Date的format方法Date.prototype.format=function(format){varo={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours(),"m+":this.getMinutes(),"s+":this.getSeconds()...
/***@function将时间戳转化为日+小时+分+秒*@param{Date}时间戳*@return{String}时间字符串*/formatTime:function(longTime){//转化为日+小时+分+秒vartime=parseFloat(longTime);if(time!=null&&time!=""){if(time<60)...