栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > Web开发 > JavaScript

Javascript下判断是否为闰年的Datetime包

JavaScript 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Javascript下判断是否为闰年的Datetime包

来看看源码:
复制代码 代码如下:


if (typeof jscript == 'undefined') {
jscript = function() { }
}

jscript.datetime = function() { }


jscript.datetime.getNumberDaysInMonth = function(inMonth, inYear) {

inMonth = inMonth - 1;
var leap_year = this.isLeapYear(inYear);
if (leap_year) {
leap_year = 1;
} else {
leap_year = 0;
}

if (inMonth == 3 || inMonth == 5 || inMonth == 8 || inMonth == 10) {
return 30;
} else if (inMonth == 1) {
return 28 + leap_year;
} else {
return 31;
}

} // End getNumberDaysInMonth().



jscript.datetime.isLeapYear = function(inYear) {

if ((inYear % 4 == 0 && !(inYear % 100 == 0)) || inYear % 400 == 0) {
return true;
} else {
return false;
}

} // End isLeapYear().
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/115157.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号