JavaScript版DateAdd和DateDiff函数代码_javascript技巧_脚

来源:http://www.mnuet.com 作者:论坛中心 人气:86 发布时间:2020-03-22
摘要:DateAdd函数: 复制代码 代码如下: functionDateAdd{ switch(interval.toLowerCase{ case "y": return newDate(date.setFullYear+numberState of Qatar卡塔尔国; case "m": return newDate(date.setMonth+number卡塔尔State of Qatar; case

DateAdd函数: 复制代码 代码如下: function DateAdd{ switch(interval.toLowerCase{ case "y": return new Date(date.setFullYear+numberState of Qatar卡塔尔国; case "m": return new Date(date.setMonth+number卡塔尔State of Qatar; case "d": return new Date(date.setDate+numberState of QatarState of Qatar; case "w": return new Date(date.setDate+7*numberState of QatarState of Qatar; case "h": return new Date(date.setHours+number卡塔尔State of Qatar; case "n": return new Date(date.setMinutes+number卡塔尔国State of Qatar; case "s": return new Date(date.setSeconds+number卡塔尔卡塔尔(قطر‎; case "l": return new Date(date.setMilliseconds(date.getMilliseconds; } } DateDiff函数: 复制代码 代码如下: function DateDiff{ var long = date2.getTime; //相差纳秒 switch(interval.toLowerCase{ case "y": return parseInt - date1.getFullYear; case "m": return parseInt - date1.getFullYear*12 + -date1.getMonth; case "d": return parseInt; case "w": return parseInt; case "h": return parseInt; case "n": return parseInt; case "s": return parseInt; case "l": return parseInt; } } 包容多浏览器的datediff函数 复制代码 代码如下:

本文由广东十一选五一定牛发布于论坛中心,转载请注明出处:JavaScript版DateAdd和DateDiff函数代码_javascript技巧_脚

关键词:

最火资讯