日期时间脚本库方法列表

日期时间脚本库方法列表

ID:14201670

大小:41.50 KB

页数:5页

时间:2018-07-26

日期时间脚本库方法列表_第1页
日期时间脚本库方法列表_第2页
日期时间脚本库方法列表_第3页
日期时间脚本库方法列表_第4页
日期时间脚本库方法列表_第5页
资源描述:

《日期时间脚本库方法列表》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库

1、1. 日期时间脚本库方法列表  2.Date.prototype.isLeapYear 判断闰年  3.Date.prototype.Format 日期格式化  4.Date.prototype.DateAdd 日期计算  5.Date.prototype.DateDiff 比较日期差  6.Date.prototype.toString 日期转字符串  7.Date.prototype.toArray 日期分割为数组  8.Date.prototype.DatePart 取日期的部分信息  9.Date.prototype.MaxDayOfDate 取

2、日期所在月的最大天数  10.Date.prototype.WeekNumOfYear 判断日期所在年的第几周  11.StringToDate 字符串转日期型  12.IsValidDate 验证日期有效性  13.CheckDateTime 完整日期时间检查  14.daysBetween 日期天数差   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 时间   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());

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。