久久r热视频,国产午夜精品一区二区三区视频,亚洲精品自拍偷拍,欧美日韩精品二区

您的位置:首頁技術文章
文章詳情頁

js 時間格式替代多余字符代碼

瀏覽:106日期:2024-05-24 15:23:46

Date.prototype.format = function(style) {if(style==undefined || style==null) style='yyyy-MM-dd';var o = { 'M+' : this.getMonth() + 1, //month 'd+' : this.getDate(), //day 'h+' : this.getHours(), //hour 'm+' : this.getMinutes(), //minute 's+' : this.getSeconds(), //second 'w+' : '天一二三四五六'.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;};String.prototype.createShortDisp = function(text,num){if(num==undefined || num==null) num=10; var result=text; if (text.length > num) result = text.substring(0, num) + '...'; return '<span title = ’' + text + '’>' + result + '</>';}

標簽: JavaScript
相關文章:
主站蜘蛛池模板: 漯河市| 昌乐县| 全椒县| 邢台市| 融水| 灵武市| 合江县| 南丹县| 奎屯市| 嘉黎县| 中超| 宜川县| 花莲市| 和田市| 增城市| 石嘴山市| 宝清县| 辽阳县| 丰台区| 湖南省| 醴陵市| 通城县| 卢龙县| 仙居县| 旌德县| 远安县| 介休市| 蒙城县| 平顺县| 定结县| 县级市| 巧家县| 襄城县| 水城县| 大竹县| 大洼县| 大英县| 墨脱县| 潢川县| 邵阳县| 柳河县|