怎么判断当前日期为月末? 怎么判断当前日期为月末?或者月末的前一天 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 得到某月的天数:alert((new Date(2007,2,0)).getDate()) 得到某月的天数:alert((new Date(2007,2,0)).getDate()) 得到某月的天数:alert((new Date(2007,2,0)).getDate()) http://blog.csdn.net/muxrwc/archive/2007/11/01/1860903.aspx可以参考这篇文章 http://blog.csdn.net/muxrwc/archive/2007/11/01/1860903.aspx可以参考这篇文章 <SCRIPT LANGUAGE= "JavaScript">var date = new Date();var year = date.getYear(); //当前年份var month = date.getMonth() + 1; //当前月份var day = date.getDate(); //当前日var lastDay; //最后一天 if (month == 2)//2月的特殊处理 判断闰年 { if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) { lastDay = 29; } else { lastDay = 28; } } else if (month == 4 || month == 6 || month == 9 || month == 11)//4 6 9 11月30天 { lastDay = 30; } else//1 3 5 7 8 10 12月31天 { lastDay = 31; } //判断当日是否为最后一天 if(lastDay == day) { alert("今日为月末最后一天"); } else { alert("今日非月末最后一天"); }</SCRIPT> node.js 如何访问sql server 编写一个方法 求一个字符串的字节长度 如何获取某个A标记外层的DIV,控制此DIV ★在线等!-100分求助,js如何取得网址中数据! 如何在静态页面中输出外部文件? 用js实现,输入框内容不清除,在后面补充增加内容 火狐重新附值 innerHTML后,js 调用函数出错。 form表单中如何去掉submit按钮自动得到焦点? 请问如何用CSS控制只显示Table的水平线,而不显示垂直线和边框? 小白不懂 一个下拉框的JS问题,请哪位高手帮帮忙 求助一个正则表达式的问题,有点小难度
alert((new Date(2007,2,0)).getDate())
alert((new Date(2007,2,0)).getDate())
alert((new Date(2007,2,0)).getDate())
可以参考这篇文章
可以参考这篇文章
var date = new Date();
var year = date.getYear(); //当前年份
var month = date.getMonth() + 1; //当前月份
var day = date.getDate(); //当前日
var lastDay; //最后一天
if (month == 2)//2月的特殊处理 判断闰年
{
if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0)
{
lastDay = 29;
}
else
{
lastDay = 28;
}
}
else if (month == 4 || month == 6 || month == 9 || month == 11)//4 6 9 11月30天
{
lastDay = 30;
}
else//1 3 5 7 8 10 12月31天
{
lastDay = 31;
} //判断当日是否为最后一天
if(lastDay == day)
{
alert("今日为月末最后一天");
}
else
{
alert("今日非月末最后一天");
}
</SCRIPT>