資源描述:
《日期時(shí)間腳本庫(kù)方法列表》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在行業(yè)資料-天天文庫(kù)。
1、1.?日期時(shí)間腳本庫(kù)方法列表??2.Date.prototype.isLeapYear?判斷閏年??3.Date.prototype.Format?日期格式化??4.Date.prototype.DateAdd?日期計(jì)算??5.Date.prototype.DateDiff?比較日期差??6.Date.prototype.toString?日期轉(zhuǎn)字符串??7.Date.prototype.toArray?日期分割為數(shù)組??8.Date.prototype.DatePart?取日期的部分信息??9.Date.prototype.MaxDayOfDate?取
2、日期所在月的最大天數(shù)??10.Date.prototype.WeekNumOfYear?判斷日期所在年的第幾周??11.StringToDate?字符串轉(zhuǎn)日期型??12.IsValidDate?驗(yàn)證日期有效性??13.CheckDateTime?完整日期時(shí)間檢查??14.daysBetween?日期天數(shù)差???15.??16.js?代碼???17.??18.//---------------------------------------------------???19.//?判斷閏年???20.//--------------------------
3、-------------------------???21.Date.prototype.isLeapYear?=?function()??????22.{??????23.return?(0==this.getYear()%4&&((this.getYear()%100!=0)
4、
5、(this.getYear()%400==0)));??????24.}??????25.??26.//---------------------------------------------------???27.//?日期格式化???28.//?格式?YYYY/yyy
6、y/YY/yy?表示年份???29.//?MM/M?月份???30.//?W/w?星期???31.//?dd/DD/d/D?日期???32.//?hh/HH/h/H?時(shí)間???33.//?mm/m?分鐘???34.//?ss/SS/s/S?秒???35.//---------------------------------------------------???36.Date.prototype.Format?=?function(formatStr)??????37.{??????38.var?str?=?formatStr;??????39.var
7、?Week?=?['日','一','二','三','四','五','六'];?????40.??41.?????str=str.replace(/yyyy
8、YYYY/,this.getFullYear());??????1.?????str=str.replace(/yy
9、YY/,(this.getYear()?%?100)>9?(this.getYear()?%?100).toString():'0'?+?(this.getYear()?%?100));??????2.??3.?????str=str.replace(/MM/,this.getMont
10、h()>9?this.getMonth().toString():'0'?+?this.getMonth());??????4.?????str=str.replace(/M/g,this.getMonth());??????5.??6.?????str=str.replace(/w
11、W/g,Week[this.getDay()]);??????7.??8.?????str=str.replace(/dd
12、DD/,this.getDate()>9?this.getDate().toString():'0'?+?this.getDate());??????
13、9.?????str=str.replace(/d
14、D/g,this.getDate());??????10.??11.?????str=str.replace(/hh
15、HH/,this.getHours()>9?this.getHours().toString():'0'?+?this.getHours());??????12.?????str=str.replace(/h
16、H/g,this.getHours());??????13.?????str=str.replace(/mm/,this.getMinutes()>9?this.getMinute
17、s().toString():'0'?+?this.getMinutes());